BEEP-8 Helper Lib 1.0.0
|
Module for managing pointers using handles. More...
Go to the source code of this file.
Macros | |
#define | HANDLE_NULL (0) |
Functions | |
void | Handle_Reset () |
Resets the handle management table. | |
void | Handle_Dump () |
Dumps the contents of the handle management table. | |
u32 | Handle_Entry (void *pPtr) |
Registers a pointer and returns a handle. | |
void * | Handle_GetPointer (u32 hdl) |
Retrieves a pointer from a handle. | |
bool | Handle_IsAlive (u32 hdl) |
Checks if a handle is valid. | |
void | Handle_Remove (u32 hdl) |
Removes a handle and frees the associated pointer. | |
Module for managing pointers using handles.
This module provides functions to manage pointers using handles. It allows accessing pointers through handles, checking the validity of handles, and removing handles. This is particularly useful for dynamic memory management and resource management.
This module is provided as a helper for lower-level functions of cobj. While users can use it directly, it is neither recommended nor mandatory.
Note: This module is not thread-safe. Use appropriate synchronization mechanisms if accessing it from multiple threads.
Here is an example of how to use this module to manage pointers with handles:
|
extern |
Dumps the contents of the handle management table.
This function dumps the contents of the handle management table, displaying all valid entries.
|
extern |
Registers a pointer and returns a handle.
This function registers a pointer and returns a handle that can be used to access the pointer.
pPtr | Pointer to be registered. |
|
extern |
Retrieves a pointer from a handle.
This function retrieves the pointer associated with the given handle.
hdl | Handle to be used to retrieve the pointer. |
|
extern |
Checks if a handle is valid.
This function checks if the given handle is valid and has an associated pointer.
hdl | Handle to be checked. |
|
extern |
Removes a handle and frees the associated pointer.
This function removes the given handle and frees the memory associated with the pointer.
hdl | Handle to be removed. |
|
extern |
Resets the handle management table.
This function resets the handle management table, initializing all entries and resetting the next handle to be used.