Skip to content

iox::popo::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. More...

#include <used_chunk_list.hpp>

Public Functions🔗

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

Detailed Description🔗

template <uint32_t Capacity>
class iox::popo::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 Documentation🔗

function UsedChunkList🔗

UsedChunkList()

Constructs a default UsedChunkList.

function insert🔗

bool insert(
    mepoo::SharedChunk chunk
)

Inserts a SharedChunk into the list.

Parameters:

  • chunk to store in the list

Return: true if successful, otherwise false if e.g. the list is already full

Note: only from runtime context

Todocan we do this cheaper with a global fence in cleanup?

function remove🔗

bool remove(
    const mepoo::ChunkHeader * chunkHeader,
    mepoo::SharedChunk & chunk
)

Removes a chunk from the list.

Parameters:

  • chunkHeader to look for a corresponding SharedChunk
  • chunk which is removed

Return: true if successfully removed, otherwise false if e.g. the chunkHeader was not found in the list

Note: only from runtime context

Todocan we do this cheaper with a global fence in cleanup?

function cleanup🔗

void cleanup()

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.


Updated on 26 April 2021 at 15:31:02 CEST