13#ifndef CDI_TIMEOUT_H__
14#define CDI_TIMEOUT_H__
31#define MAX_TIMERS_GROW 5
This file declares the public API data types, structures and functions that comprise the CDI low-leve...
CdiReturnStatus
Values used for API function return codes.
Definition cdi_core_api.h:189
struct CdiLogState * CdiLogHandle
Forward declaration to create pointer to log handle.
Definition cdi_log_api.h:40
The declarations in this header file correspond to the definitions in logger.c.
This file contains the declarations for OS functions for creating/managing/freeing threads,...
struct CdiSignalType_t * CdiSignalType
Define portable signal type. Don't use void* here, which prevents the compiler from type checking.
Definition cdi_os_api.h:189
pthread_mutex_t * CdiCsID
Define portable critical section.
Definition cdi_os_api.h:192
struct CdiThreadID_t * CdiThreadID
Define portable thread type. Separate name from type, otherwise the typedef that follows it will gene...
Definition cdi_os_api.h:312
This file declares the public API data types, structures and functions that comprise the CDI Pool Uti...
struct CdiPoolState * CdiPoolHandle
Type used as the handle (pointer to an opaque structure) for a Memory Pool. Each handle represents a ...
Definition cdi_pool_api.h:97
The declarations in this header file correspond to the definitions in fifo.c.
struct CdiFifoState * CdiFifoHandle
Type used as the handle (pointer to an opaque structure) for a FIFO. Each handle represents a instanc...
Definition fifo_api.h:30
The declarations in this header file correspond to the definitions in list.c. Many of the functions h...
This structure represents a single list entry.
Definition list_api.h:34
This structure represents a list.
Definition list_api.h:42
Structure for Callback functions to use to return data from callback.
Definition timeout.h:91
void * user_data_ptr
Pointer to data space for this handle.
Definition timeout.h:93
TimeoutHandle handle
Handle for timeout data state.
Definition timeout.h:92
TimeoutDataState is the basic object used to build the list of timers This object contains a timeout,...
Definition timeout.h:38
void * user_data_ptr
pointer to user data that can be used in callback function
Definition timeout.h:46
CdiListEntry list_entry
store an instance of this object in a list ordered by deadline_us values
Definition timeout.h:40
uint64_t deadline_us
when will this object expire in microseconds
Definition timeout.h:42
void * cb_ptr
pointer to callback function to execute if this item expires
Definition timeout.h:44
This structure contains all of the state information for the timer instance. This includes signals,...
Definition timeout.h:60
CdiSignalType stop_signal
stop_signal indicates someone has removed active timeout or added a timeout with a closer deadline
Definition timeout.h:72
CdiSignalType go_signal
go_signal indicates that there is at least one active timer entry
Definition timeout.h:68
CdiPoolHandle mem_pool_handle
Pool of available TimeoutDataState objects.
Definition timeout.h:76
CdiThreadID cb_thread_id
Thread ID for the thread that executes the callback functions.
Definition timeout.h:64
CdiCsID critical_section
Critical section to indicate that timeout_list is being modified.
Definition timeout.h:78
CdiLogHandle log_handle
Handle of log to use for this timeout's main thread.
Definition timeout.h:80
CdiSignalType shutdown_signal
shutdown timer instance signaled from CdiTimeoutDestroy
Definition timeout.h:70
CdiThreadID main_thread_id
Thread ID for the main timeout management thread.
Definition timeout.h:62
CdiList timeout_list
list of active timeout objects
Definition timeout.h:74
CdiFifoHandle cb_fifo_handle
handle for the FIFO that main thread puts callbacks into for callback thread to execute
Definition timeout.h:66
struct TimeoutDataState * TimeoutHandle
This is the handle for TimeoutDataState.
Definition timeout.h:54
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 occ...
Definition timeout.c:305
void(* CdiTimeoutCallback)(const CdiTimeoutCbData *data_ptr)
Callback function definition used by CdiTimeoutAdd.
Definition timeout.h:97
CdiReturnStatus CdiTimeoutCreate(CdiLogHandle log_handle, CdiTimeoutInstanceHandle *ret_handle)
Creates a TimeoutInstanceState structure memory allocated for a pool of TimeoutDataState structures a...
Definition timeout.c:196
void CdiTimeoutDestroy(CdiTimeoutInstanceHandle handle)
Destroys a TimeoutInstanceState structure freeing associated mememory and other resources such as wak...
Definition timeout.c:283
struct TimeoutInstanceState * CdiTimeoutInstanceHandle
a handle for use with TimeoutInstanceState structure
Definition timeout.h:88
bool CdiTimeoutRemove(TimeoutHandle handle, CdiTimeoutInstanceHandle instance_handle)
Removes a timeout from the timeout list thread, generally upon completion of operation.
Definition timeout.c:364