|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Dynamic package initialization. More...
#include <sys/cdefs.h>Go to the source code of this file.
Macros | |
| #define | KTHREAD_ONCE_INIT 0 |
| Initializer for a kthread_once_t object. | |
Typedefs | |
| typedef volatile int | kthread_once_t |
| Object type backing kthread_once. | |
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 0 |
Initializer for a kthread_once_t object.
| typedef volatile int kthread_once_t |
Object type backing kthread_once.
This object type should always be initialized with the KTHREAD_ONCE_INIT macro.
| int kthread_once | ( | kthread_once_t * | once_control, |
| void(* | init_routine )(void) ) |
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: EPERM if called inside an interrupt or EINVAL if *once_control is not valid or was not initialized with KTHREAD_ONCE_INIT. |
| 0 | On success. |