#define AXIS2_THREAD_MUTEX_DEFAULT 0x0 |
platform-optimal lock behavior
#define AXIS2_THREAD_MUTEX_NESTED 0x1 |
enable nested (recursive) locks
#define AXIS2_THREAD_MUTEX_UNNESTED 0x2 |
disable nested locks
typedef struct axutil_thread_mutex_t axutil_thread_mutex_t |
Opaque thread-local mutex structure
typedef struct axutil_thread_once_t axutil_thread_once_t |
Control variable for one-time atomic variables.
typedef void*( AXIS2_THREAD_FUNC * axutil_thread_start_t)(axutil_thread_t *, void *) |
The prototype for any AXIS2 thread worker functions.
typedef struct axutil_thread_t axutil_thread_t |
Thread callbacks from axis2 functions must be declared with AXIS2_THREAD_FUNC so that they follow the platform's calling convention. Thread structure.
typedef struct axutil_threadattr_t axutil_threadattr_t |
Thread attributes structure.
typedef struct axutil_threadkey_t axutil_threadkey_t |
Thread private address space.
AXIS2_EXTERN axutil_thread_t* axutil_thread_create | ( | axutil_allocator_t * | allocator, | |
axutil_threadattr_t * | attr, | |||
axutil_thread_start_t | func, | |||
void * | data | |||
) |
Create a new thread of execution
attr | The threadattr to use to determine how to create the thread | |
func | The function to start the new thread in | |
data | Any data to be passed to the starting function | |
cont | The pool to use |
AXIS2_EXTERN axis2_status_t axutil_thread_detach | ( | axutil_thread_t * | thd | ) |
detach a thread
thd | The thread to detach |
AXIS2_EXTERN axis2_status_t axutil_thread_exit | ( | axutil_thread_t * | thd, | |
axutil_allocator_t * | allocator | |||
) |
Stop the current thread
thd | The thread to stop |
AXIS2_EXTERN axis2_status_t axutil_thread_join | ( | axutil_thread_t * | thd | ) |
Block until the desired thread stops executing.
thd | The thread to join |
AXIS2_EXTERN axutil_thread_mutex_t* axutil_thread_mutex_create | ( | axutil_allocator_t * | allocator, | |
unsigned int | flags | |||
) |
Create and initialize a mutex that can be used to synchronize threads.
allocator | Memory allocator to allocate memory for the mutex |
AXIS2_EXTERN axis2_status_t axutil_thread_mutex_destroy | ( | axutil_thread_mutex_t * | mutex | ) |
Destroy the mutex and free the memory associated with the lock.
mutex | the mutex to destroy. |
AXIS2_EXTERN axis2_status_t axutil_thread_mutex_lock | ( | axutil_thread_mutex_t * | mutex | ) |
Acquire the lock for the given mutex. If the mutex is already locked, the current thread will be put to sleep until the lock becomes available.
mutex | the mutex on which to acquire the lock. |
AXIS2_EXTERN axis2_status_t axutil_thread_mutex_trylock | ( | axutil_thread_mutex_t * | mutex | ) |
Attempt to acquire the lock for the given mutex. If the mutex has already been acquired, the call returns immediately
mutex | the mutex on which to attempt the lock acquiring. |
AXIS2_EXTERN axis2_status_t axutil_thread_mutex_unlock | ( | axutil_thread_mutex_t * | mutex | ) |
Release the lock for the given mutex.
mutex | the mutex from which to release the lock. |
AXIS2_EXTERN axis2_status_t axutil_thread_once | ( | axutil_thread_once_t * | control, | |
void(*)(void) | func | |||
) |
Run the specified function one time, regardless of how many threads call it.
control | The control variable. The same variable should be passed in each time the function is tried to be called. This is how the underlying functions determine if the function has ever been called before. | |
func | The function to call. |
AXIS2_EXTERN axutil_thread_once_t* axutil_thread_once_init | ( | axutil_allocator_t * | allocator | ) |
Initialize the control variable for axutil_thread_once.
control | The control variable to initialize |
AXIS2_EXTERN void axutil_thread_yield | ( | void | ) |
force the current thread to yield the processor
AXIS2_EXTERN axutil_threadattr_t* axutil_threadattr_create | ( | axutil_allocator_t * | allocator | ) |
Create and initialize a new threadattr variable
cont | The pool to use |
AXIS2_EXTERN axis2_status_t axutil_threadattr_detach_set | ( | axutil_threadattr_t * | attr, | |
axis2_bool_t | detached | |||
) |
Set if newly created threads should be created in detached state.
attr | The threadattr to affect | |
on | Non-zero if detached threads should be created. |
AXIS2_EXTERN axis2_bool_t axutil_threadattr_is_detach | ( | axutil_threadattr_t * | attr, | |
axutil_allocator_t * | allocator | |||
) |
Get the detach state for this threadattr.
attr | The threadattr to reference |