RTEMS 6.3
Loading...
Searching...
No Matches
Freechain Handler

This group contains the Freechain Handler implementation. More...

Files

file  cpukit/include/rtems/score/freechain.h
 This header file provides interfaces of the Freechain Handler which are used by the implementation and the Application Configuration.
file  cpukit/include/rtems/score/freechainimpl.h
 This header file provides interfaces of the Barrier Handler which are only used by the implementation.
file  cpukit/score/src/freechain.c
 This source file contains the implementation of _Freechain_Extend(), _Freechain_Get(), and _Freechain_Put().

Data Structures

struct  Freechain_Control
 The freechain control. More...

Typedefs

typedef void *(*) Freechain_Allocator(size_t size)
 Allocator function.

Functions

void * _Freechain_Extend (Freechain_Control *freechain, Freechain_Allocator allocator, size_t number_nodes_to_extend, size_t node_size)
 Extend the freechain with new nodes.
void * _Freechain_Get (Freechain_Control *freechain, Freechain_Allocator allocator, size_t number_nodes_to_extend, size_t node_size)
 Gets a node from the freechain.
void _Freechain_Put (Freechain_Control *freechain, void *node)
 Puts a node back onto the freechain.

Detailed Description

This group contains the Freechain Handler implementation.

This handler encapsulates functionality related to the management of free nodes of a user-defined size. If the chain of free nodes is empty during an allocation request, it can be dynamically extended.

Function Documentation

◆ _Freechain_Extend()

void * _Freechain_Extend ( Freechain_Control * freechain,
Freechain_Allocator allocator,
size_t number_nodes_to_extend,
size_t node_size )

Extend the freechain with new nodes.

Parameters
freechainThe freechain control.
allocatorThe allocator function.
number_nodes_to_extendThe number of nodes to extend.
node_sizeThe node size.
Return values
NULLThe extend operation failed.
nodesPointer to the new nodes.

◆ _Freechain_Get()

void * _Freechain_Get ( Freechain_Control * freechain,
Freechain_Allocator allocator,
size_t number_nodes_to_extend,
size_t node_size )

Gets a node from the freechain.

Parameters
[in,out]freechainThe freechain control.
allocatorThe allocator function.
number_nodes_to_extendThe number of nodes in the case an extend is necessary due to an empty freechain.
[in]node_sizeThe node size.
Return values
NULLThe freechain is empty and the extend operation failed.
pointerPointer to a node. The node ownership passes to the caller.

◆ _Freechain_Put()

void _Freechain_Put ( Freechain_Control * freechain,
void * node )

Puts a node back onto the freechain.

Parameters
[in,out]freechainThe freechain control.
[out]nodeThe node to put back. The node may be NULL, in this case the function does nothing.