Template Class UsedChunkList
Defined in File used_chunk_list.hpp
Class Documentation
-
template<uint32_t Capacity>
class UsedChunkList This class is used to keep track of the chunks currently in use by the application. In case the application terminates while holding chunks, this list is used by RouDi to retain ownership of the chunks and prevent a chunk leak. In order to always be able to access the used chunks, neither a vector or list can be used, because these container could be corrupted when the application dies in the wrong moment. To be able to do the cleanup, RouDi needs to be able to access the list with the used chunk under all circumstances. This is achieved by storing the ChunkManagement pointer in an array which can always be accessed. Additionally, the type stored is this array must be less or equal to 64 bit in order to write it within one clock cycle to prevent torn writes, which would corrupt the list and could potentially crash RouDi.
Public Functions
-
UsedChunkList() noexcept
Constructs a default UsedChunkList.
Inserts a SharedChunk into the list.
Note
only from runtime context
- Parameters:
chunk – [in] to store in the list
- Returns:
true if successful, otherwise false if e.g. the list is already full
Removes a chunk from the list.
Note
only from runtime context
- Parameters:
chunkHeader – [in] to look for a corresponding SharedChunk
chunk – [out] which is removed
- Returns:
true if successfully removed, otherwise false if e.g. the chunkHeader was not found in the list
-
void cleanup() noexcept
Cleans up all the remaining chunks from the list.
Note
from RouDi context once the applications walked the plank. It is unsafe to call this if the application is still running.
-
UsedChunkList() noexcept