|
KallistiOS
2.0.0
|
Dynamic package initialization. More...
#include <sys/cdefs.h>Go to the source code of this file.
Data Structures | |
| struct | kthread_once_t |
| Object type backing kthread_once. More... | |
Macros | |
| #define | KTHREAD_ONCE_INIT { 1, 0 } |
| Initializer for a kthread_once_t object. | |
Functions | |
| int | kthread_once (kthread_once_t *once_control, void(*init_routine)(void)) |
| Run a function once. | |
Dynamic package initialization.
This file provides definitions for an object that functions the same way as the pthread_once_t function does from the POSIX specification. This object type and functionality is generally used to make sure that a given initialization function is run once, and only once, no matter how many threads attempt to call it.
| #define KTHREAD_ONCE_INIT { 1, 0 } |
Initializer for a kthread_once_t object.
| int kthread_once | ( | kthread_once_t * | once_control, |
| void(*)(void) | init_routine | ||
| ) |
Run a function once.
This function, when used with a kthread_once_t object (that should be shared amongst all threads) will run the init_routine once, and set the once_control to make sure that the function will not be run again (as long as all threads attempt to call the init_routine through this function.
| once_control | The kthread_once_t object to run against. |
| init_routine | The function to call. |
| -1 | On failure, and sets errno to one of the following: ENOMEM if out of memory, EPERM if called inside an interrupt, or EINTR if interrupted. |
| 0 | On success. |
1.8.1.1