NAME¶
globus_thread.h -
Globus Threading Abstraction.
SYNOPSIS¶
#include 'globus_module.h'
#include 'globus_time.h'
#include <unistd.h>
Data Structures¶
union
globus_thread_t
Thread ID. union
globus_threadattr_t
Thread attributes. union
globus_mutex_t
Mutex. union
globus_cond_t
Condition variable. union
globus_mutexattr_t
Mutex attribute. union
globus_condattr_t
Condition variable attribute. union
globus_thread_key_t
Thread-specific data key. union
globus_thread_once_t
Thread once structure.
Macros¶
#define
GLOBUS_THREAD_ONCE_INIT { .none = 0 }
Thread once initializer value. #define
GLOBUS_THREAD_CANCEL_DISABLE 0
Disable thread cancellation value. #define
GLOBUS_THREAD_CANCEL_ENABLE 1
Enable thread cancellation value. #define
GLOBUS_THREAD_MODULE
(&globus_i_thread_module)
Thread Module.
Typedefs¶
typedef void(*
globus_thread_key_destructor_func_t )(void *value)
Thread-specific data destructor.
Functions¶
int
globus_thread_set_model (const char *model)
Select threading model for an application. int
globus_mutex_init
(
globus_mutex_t *mutex,
globus_mutexattr_t *attr)
Initialize a mutex. int
globus_mutex_destroy
(
globus_mutex_t *mutex)
Destroy a mutex. int
globus_mutex_lock (
globus_mutex_t
*mutex)
Lock a mutex. int
globus_mutex_unlock (
globus_mutex_t
*mutex)
Unlock a mutex. int
globus_mutex_trylock (
globus_mutex_t
*mutex)
Lock a mutex if it is not locked. int
globus_cond_init
(
globus_cond_t *cond,
globus_condattr_t *attr)
Initialize a condition variable
The
globus_cond_init() function creates a condition variable that can be
used for event signalling between threads.
" int
globus_cond_destroy (
globus_cond_t *cond)
Destroy a condition variable. int
globus_cond_wait
(
globus_cond_t *cond,
globus_mutex_t *mutex)
Wait for a condition to be signalled. int
globus_cond_timedwait
(
globus_cond_t *cond,
globus_mutex_t *mutex, globus_abstime_t
*abstime)
Wait for a condition to be signalled. int
globus_cond_signal
(
globus_cond_t *cond)
Signal a condition to a thread. int
globus_cond_broadcast
(
globus_cond_t *cond)
Signal a condition to multiple threads. int
globus_condattr_init
(
globus_condattr_t *cond_attr)
Initialize a condition variable attribute. int
globus_condattr_destroy (
globus_condattr_t *cond_attr)
Destroy a condition attribute. int
globus_condattr_setspace
(
globus_condattr_t *cond_attr, int space)
Set callback space associated with a condition variable attribute
The
globus_condattr_setspace() function sets the callback space to use
with condition variables created with this attribute. Callback spaces are used
to control how callbacks are issued to different threads. See
Callback
Spaces for more information on callback spaces.
" int
globus_condattr_getspace (
globus_condattr_t *cond_attr, int
*space)
Get callback space associated with a condition variable attribute
The
globus_condattr_getspace() function copies the value of the callback
space associated with a condition variable attribute to the integer pointed to
by the
space parameter.
" int
globus_thread_create
(
globus_thread_t *thread,
globus_threadattr_t *attr,
globus_thread_func_t func, void *user_arg)
Create a new thread. void *
globus_thread_getspecific
(
globus_thread_key_t key)
Get a thread-specific data value. int
globus_thread_setspecific
(
globus_thread_key_t key, void *value)
Set a thread-specific data value. int
globus_thread_key_create
(
globus_thread_key_t *key,
globus_thread_key_destructor_func_t
func)
Create a key for thread-specific storage. int
globus_thread_key_delete (
globus_thread_key_t key)
Delete a thread-local storage key. int
globus_thread_once
(
globus_thread_once_t *once, void(*init_routine)(void))
Execute a function one time. void
globus_thread_yield (void)
Yield execution to another thread. int
globus_thread_sigmask (int
how, const sigset_t *newmask, sigset_t *oldmask)
Modify the current thread's signal mask. int
globus_thread_kill
(
globus_thread_t thread, int sig)
Send a signal to a thread. void
globus_thread_exit (void *value)
Terminate the current thread. globus_thread_t
globus_thread_self (void)
Determine the current thread's ID. int
globus_thread_equal
(
globus_thread_t thread1,
globus_thread_t thread2)
Check whether thread identifiers match. globus_bool_t
globus_i_am_only_thread (void)
Determine if threads are supported. globus_bool_t
globus_thread_preemptive_threads (void)
Indicate whether the active thread model supports preemption. void *
globus_thread_cancellable_func (void *(*func)(void *), void *arg,
void(*cleanup_func)(void *), void *cleanup_arg,
globus_bool_t
execute_cleanup)
Execute a function with thread cleanup in case of cancellation. int
globus_thread_cancel (
globus_thread_t thr)
Cancel a thread. void
globus_thread_testcancel (void)
Thread cancellation point. int
globus_thread_setcancelstate (int
state, int *oldstate)
Set the thread's cancellable state.
Detailed Description¶
Globus Threading Abstraction.
Globus threads package which can work with either pthreads or without threads,
depending on runtime configuration
Author¶
Generated automatically by Doxygen for globus_common from the source code.