CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
|
The declarations in this header file correspond to the definitions in timeout.c. More...
#include <stdbool.h>
#include "cdi_core_api.h"
#include "cdi_logger_api.h"
#include "cdi_os_api.h"
#include "cdi_pool_api.h"
#include "fifo_api.h"
#include "list_api.h"
Go to the source code of this file.
Data Structures | |
struct | TimeoutDataState |
TimeoutDataState is the basic object used to build the list of timers This object contains a timeout, a next and previous handle, and user data pointer, and a user data callback function pointer. More... | |
struct | TimeoutInstanceState |
This structure contains all of the state information for the timer instance. This includes signals, thread ID's, and pointers to the memory pool and timer list. More... | |
struct | CdiTimeoutCbData |
Structure for Callback functions to use to return data from callback. More... | |
Macros | |
#define | MAX_TIMERS 25 |
Maximum number of timers per timeout instance. | |
#define | MAX_TIMERS_GROW 5 |
Number of timers that may be added when increasing memory pool if needed. | |
Typedefs | |
typedef struct TimeoutDataState | TimeoutDataState |
TimeoutDataState is the basic object used to build the list of timers This object contains a timeout, a next and previous handle, and user data pointer, and a user data callback function pointer. | |
typedef struct TimeoutDataState * | TimeoutHandle |
This is the handle for TimeoutDataState. | |
typedef struct TimeoutInstanceState | TimeoutInstanceState |
This structure contains all of the state information for the timer instance. This includes signals, thread ID's, and pointers to the memory pool and timer list. | |
typedef struct TimeoutInstanceState * | CdiTimeoutInstanceHandle |
a handle for use with TimeoutInstanceState structure | |
typedef void(* | CdiTimeoutCallback) (const CdiTimeoutCbData *data_ptr) |
Callback function definition used by CdiTimeoutAdd. | |
Functions | |
CdiReturnStatus | CdiTimeoutCreate (CdiLogHandle log_handle, CdiTimeoutInstanceHandle *ret_handle) |
Creates a TimeoutInstanceState structure memory allocated for a pool of TimeoutDataState structures as well as all signals and threads setup. | |
void | CdiTimeoutDestroy (CdiTimeoutInstanceHandle handle) |
Destroys a TimeoutInstanceState structure freeing associated mememory and other resources such as waking associated threads get them to exit. | |
bool | CdiTimeoutAdd (CdiTimeoutInstanceHandle instance_handle, CdiTimeoutCallback cb_ptr, int timeout_us, void *user_data_ptr, TimeoutHandle *ret_handle) |
Adds a timeout to the active timeout list and puts the timeout in order based on when the timeout occurs. | |
bool | CdiTimeoutRemove (TimeoutHandle handle, CdiTimeoutInstanceHandle instance_handle) |
Removes a timeout from the timeout list thread, generally upon completion of operation. | |
The declarations in this header file correspond to the definitions in timeout.c.
bool CdiTimeoutAdd | ( | CdiTimeoutInstanceHandle | instance_handle, |
CdiTimeoutCallback | cb_ptr, | ||
int | timeout_us, | ||
void * | user_data_ptr, | ||
TimeoutHandle * | ret_handle ) |
Adds a timeout to the active timeout list and puts the timeout in order based on when the timeout occurs.
instance_handle | Pointer to this timeout instance. |
cb_ptr | Pointer to Callback data structure CdiTimeoutCbData |
timeout_us | Timeout time in microseconds |
user_data_ptr | Pointer to user data for this object. |
ret_handle | a Handle returned of CdiTimeoutCbData object |
CdiReturnStatus CdiTimeoutCreate | ( | CdiLogHandle | log_handle, |
CdiTimeoutInstanceHandle * | ret_handle ) |
Creates a TimeoutInstanceState structure memory allocated for a pool of TimeoutDataState structures as well as all signals and threads setup.
log_handle | Handle of log to use for log messages by this object's internal threads. |
ret_handle | returns the handle to the TimeoutInstanceState structure |
void CdiTimeoutDestroy | ( | CdiTimeoutInstanceHandle | handle | ) |
Destroys a TimeoutInstanceState structure freeing associated mememory and other resources such as waking associated threads get them to exit.
handle | is the handle for the TimeoutInstanceState structure to be destroyed and have associated resources freed. |
bool CdiTimeoutRemove | ( | TimeoutHandle | handle, |
CdiTimeoutInstanceHandle | instance_handle ) |
Removes a timeout from the timeout list thread, generally upon completion of operation.
handle | for the timeout that is to be removed from the timeout list |
instance_handle | for the thread level state data |