iceoryx_doc  1.0.1
Public Member Functions | List of all members
iox::popo::UsedChunkList< Capacity > Class Template Reference

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>

Public Member Functions

 UsedChunkList () noexcept
 Constructs a default UsedChunkList.
 
bool insert (mepoo::SharedChunk chunk) noexcept
 Inserts a SharedChunk into the list. More...
 
bool remove (const mepoo::ChunkHeader *chunkHeader, mepoo::SharedChunk &chunk) noexcept
 Removes a chunk from the list. More...
 
void cleanup () noexcept
 Cleans up all the remaining chunks from the list. More...
 

Detailed Description

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.

Member Function Documentation

◆ cleanup()

template<uint32_t Capacity>
void iox::popo::UsedChunkList< Capacity >::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.

◆ insert()

template<uint32_t Capacity>
bool iox::popo::UsedChunkList< Capacity >::insert ( mepoo::SharedChunk  chunk)
noexcept

Inserts a SharedChunk into the list.

Parameters
[in]chunkto 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>
bool iox::popo::UsedChunkList< Capacity >::remove ( const mepoo::ChunkHeader chunkHeader,
mepoo::SharedChunk chunk 
)
noexcept

Removes a chunk from the list.

Parameters
[in]chunkHeaderto look for a corresponding SharedChunk
[out]chunkwhich 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: