CNDP
22.08.0
|
Go to the source code of this file.
Typedefs | |
typedef void(* | on_exit_fn_t) (int sig, void *arg, int exit_type) |
Enumerations | |
enum | { CNE_CAUGHT_SIGNAL , CNE_CALLED_EXIT , CNE_USER_EXIT , MAX_EXIT_TYPES } |
Functions | |
CNDP_API int | cne_init (void) |
CNDP_API int | cne_on_exit (on_exit_fn_t exit_fn, void *arg, int *signals, int nb_signals) |
CNDP_API int | cne_initial_uid (void) |
CNDP_API int | cne_entry_uid (void) |
CNDP_API int | cne_register (const char *name) |
CNDP_API int | cne_unregister (int tidx) |
CNDP_API int | cne_set_private (int tidx, void *v) |
CNDP_API int | cne_get_private (int tidx, void **v) |
CNDP_API int | cne_id (void) |
CNDP_API int | cne_max_threads (void) |
CNDP_API int | cne_next_id (int uid, int skip, int wrap) |
CNDP_API int | cne_active_threads (void) |
CNDP_API void | cne_dump (FILE *f) |
static const char * | copyright_msg (void) |
static const char * | copyright_msg_short (void) |
static const char * | powered_by (void) |
API for CNE setup routines.
Definition in file cne.h.
typedef void(* on_exit_fn_t) (int sig, void *arg, int exit_type) |
The typedef for the on exit function pointer.
sig | The signal number supplied in the signal handler function. |
arg | The user supplied argument used as an argument to the exit_fn function. |
exit_type | The type of exit signal or exit() was called, CNE_CAUGHT_SIGNAL or CNE_CALLED_EXIT |
anonymous enum |
CNDP_API int cne_init | ( | void | ) |
Set the get_id function pointer and finish initialization
The API initializes the UID and other basic system configuration to enable user application threads to work with CNDP APIs.
This API, needs to be only called once per process, during the main thread startup.
CNDP_API int cne_on_exit | ( | on_exit_fn_t | exit_fn, |
void * | arg, | ||
int * | signals, | ||
int | nb_signals | ||
) |
Call signal handler and function pointer with argument, when a signal is caught or on exit.
exit_fn | The function pointer to call when a signal is caught. If the signal is not in the signals array then standard system operations are performed. |
arg | The user supplied argument used as an argument to the exit_fn function. |
signals | A integer array of signal value to handle via signal() function. Can be NULL pointer as long as the nb_signals is zero. |
nb_signals | The number of signal values in the signals array, can be zero. |
CNDP_API int cne_initial_uid | ( | void | ) |
Return the initial UID value for the main thread.
CNDP_API int cne_entry_uid | ( | void | ) |
Return the UID value for the current instance.
CNDP_API int cne_register | ( | const char * | name | ) |
Register an instance/thread and return the uid value.
Not thread safe. Mutual exclusion needs to be assured by user. This API is used to register the main thread or when the developer uses some other type of threading model and not the lib/usr/clib/thread library.
name | The name of the instance used for debugging |
CNDP_API int cne_unregister | ( | int | tidx | ) |
Unregister the instance and reclaim the UID value.
Not thread safe. Mutual exclusion needs to be assured by user. Release the UID value for the given thread index value or use the current thread index value.
tidx | The instance value from the cne_registers() call. When tidx is -1 then use the current thread id value. |
CNDP_API int cne_set_private | ( | int | tidx, |
void * | v | ||
) |
Set a private value with the uid value
tidx | The uid index value, if -1 then use the current thread index value. |
v | The private pointer value to save |
CNDP_API int cne_get_private | ( | int | tidx, |
void ** | v | ||
) |
Get a private value with the uid value
tidx | The uid index value, if -1 then use the current thread index value. |
v | The private pointer to pointer value to retrieve |
CNDP_API int cne_id | ( | void | ) |
Get the unique ID value using the internal ID get routine
CNDP_API int cne_max_threads | ( | void | ) |
Return the max number of threads allowed
CNDP_API int cne_next_id | ( | int | uid, |
int | skip, | ||
int | wrap | ||
) |
Return the next thread ID value
uid | Starting UID |
skip | Skip the initial thread if set. |
wrap | Wrap the UID to the beginning |
CNDP_API int cne_active_threads | ( | void | ) |
Return the number of active threads in the system.
CNDP_API void cne_dump | ( | FILE * | f | ) |
Dump out information about CNE environment
f | File pointer to use to write the data, if NULL use stdout. |
|
inlinestatic |
|
inlinestatic |