Class ShmSafeUnmanagedChunk
Defined in File shm_safe_unmanaged_chunk.hpp
Class Documentation
-
class ShmSafeUnmanagedChunk
This class to safely store a chunk in shared memory. To be able to do so, torn writes/reads need to prevented, since they create Frankenstein objects. Therefore, the class must not be larger than 64 bits and trivially copy-able in case an application dies while writing this and RouDi needs to clean up.
Public Functions
-
ShmSafeUnmanagedChunk() noexcept = default
takes a SharedChunk without decrementing the chunk reference counter
Creates a SharedChunk without incrementing the chunk reference counter and invalidates itself.
Creates a SharedChunk with incrementing the chunk reference counter and does not invalidate itself.
-
bool isLogicalNullptr() const noexcept
Checks if the underlying RelativePointerData to the chunk is logically a nullptr.
- Returns:
true if logically a nullptr otherwise false
-
ChunkHeader *getChunkHeader() noexcept
Access to the ChunkHeader of the underlying chunk.
- Returns:
the pointer to the ChunkHeader of the underlying chunk or nullptr if isLogicalNullptr would return true
-
const ChunkHeader *getChunkHeader() const noexcept
const access to the ChunkHeader of the underlying chunk
- Returns:
the const pointer to the ChunkHeader of the underlying chunk or nullptr if isLogicalNullptr would return true
-
bool isNotLogicalNullptrAndHasNoOtherOwners() const noexcept
Checks if the underlying RelativePointerData to the chunk is neither logically a nullptr nor that the chunk has other owner.
- Returns:
true if neither logically a nullptr nor other owner chunk owners present, otherwise false
-
ShmSafeUnmanagedChunk() noexcept = default