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.
More...
#include <used_chunk_list.hpp>
template<uint32_t Capacity>
class iox::popo::UsedChunkList< Capacity >
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.
◆ cleanup()
template<uint32_t Capacity>
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.
◆ insert()
template<uint32_t Capacity>
Inserts a SharedChunk into the list.
- Parameters
-
[in] | chunk | to store in the list |
- Returns
- true if successful, otherwise false if e.g. the list is already full
- Note
- only from runtime context
- Todo:
- can we do this cheaper with a global fence in cleanup?
◆ remove()
template<uint32_t Capacity>
Removes a chunk from the list.
- Parameters
-
[in] | chunkHeader | to look for a corresponding SharedChunk |
[out] | chunk | which is removed |
- Returns
- true if successfully removed, otherwise false if e.g. the chunkHeader was not found in the list
- Note
- only from runtime context
- Todo:
- can we do this cheaper with a global fence in cleanup?
The documentation for this class was generated from the following files: