globus_common  18.5
Data Structures | Macros | Typedefs | Functions
globus_thread.h File Reference

Globus Threading Abstraction. More...

#include "globus_module.h"
#include "globus_time.h"
#include <unistd.h>

Go to the source code of this file.

Data Structures

union  globus_thread_t
 Thread ID. More...
 
union  globus_threadattr_t
 Thread attributes. More...
 
union  globus_mutex_t
 Mutex. More...
 
union  globus_cond_t
 Condition variable. More...
 
union  globus_mutexattr_t
 Mutex attribute. More...
 
union  globus_condattr_t
 Condition variable attribute. More...
 
union  globus_thread_key_t
 Thread-specific data key. More...
 
union  globus_thread_once_t
 Thread once structure. More...
 

Macros

#define GLOBUS_THREAD_ONCE_INIT   { .none = 0 }
 Thread once initializer value.
 
#define GLOBUS_THREAD_CANCEL_DISABLE   0
 Disable thread cancellation value. More...
 
#define GLOBUS_THREAD_CANCEL_ENABLE   1
 Enable thread cancellation value. More...
 
#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. More...
 
int globus_mutex_init (globus_mutex_t *mutex, globus_mutexattr_t *attr)
 Initialize a mutex. More...
 
int globus_mutex_destroy (globus_mutex_t *mutex)
 Destroy a mutex. More...
 
int globus_mutex_lock (globus_mutex_t *mutex)
 Lock a mutex. More...
 
int globus_mutex_unlock (globus_mutex_t *mutex)
 Unlock a mutex. More...
 
int globus_mutex_trylock (globus_mutex_t *mutex)
 Lock a mutex if it is not locked. More...
 
int globus_cond_init (globus_cond_t *cond, globus_condattr_t *attr)
 Initialize a condition variable. More...
 
int globus_cond_destroy (globus_cond_t *cond)
 Destroy a condition variable. More...
 
int globus_cond_wait (globus_cond_t *cond, globus_mutex_t *mutex)
 Wait for a condition to be signalled. More...
 
int globus_cond_timedwait (globus_cond_t *cond, globus_mutex_t *mutex, globus_abstime_t *abstime)
 Wait for a condition to be signalled. More...
 
int globus_cond_signal (globus_cond_t *cond)
 Signal a condition to a thread. More...
 
int globus_cond_broadcast (globus_cond_t *cond)
 Signal a condition to multiple threads. More...
 
int globus_condattr_init (globus_condattr_t *cond_attr)
 Initialize a condition variable attribute. More...
 
int globus_condattr_destroy (globus_condattr_t *cond_attr)
 Destroy a condition attribute. More...
 
int globus_condattr_setspace (globus_condattr_t *cond_attr, int space)
 Set callback space associated with a condition variable attribute. More...
 
int globus_condattr_getspace (globus_condattr_t *cond_attr, int *space)
 Get callback space associated with a condition variable attribute. More...
 
int globus_thread_create (globus_thread_t *thread, globus_threadattr_t *attr, globus_thread_func_t func, void *user_arg)
 Create a new thread. More...
 
void * globus_thread_getspecific (globus_thread_key_t key)
 Get a thread-specific data value. More...
 
int globus_thread_setspecific (globus_thread_key_t key, void *value)
 Set a thread-specific data value. More...
 
int globus_thread_key_create (globus_thread_key_t *key, globus_thread_key_destructor_func_t func)
 Create a key for thread-specific storage. More...
 
int globus_thread_key_delete (globus_thread_key_t key)
 Delete a thread-local storage key. More...
 
int globus_thread_once (globus_thread_once_t *once, void(*init_routine)(void))
 Execute a function one time. More...
 
void globus_thread_yield (void)
 Yield execution to another thread. More...
 
int globus_thread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask)
 Modify the current thread's signal mask. More...
 
int globus_thread_kill (globus_thread_t thread, int sig)
 Send a signal to a thread. More...
 
void globus_thread_exit (void *value)
 Terminate the current thread. More...
 
globus_thread_t globus_thread_self (void)
 Determine the current thread's ID. More...
 
int globus_thread_equal (globus_thread_t thread1, globus_thread_t thread2)
 Check whether thread identifiers match. More...
 
globus_bool_t globus_i_am_only_thread (void)
 Determine if threads are supported. More...
 
globus_bool_t globus_thread_preemptive_threads (void)
 Indicate whether the active thread model supports preemption. More...
 
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. More...
 
int globus_thread_cancel (globus_thread_t thr)
 Cancel a thread. More...
 
void globus_thread_testcancel (void)
 Thread cancellation point. More...
 
int globus_thread_setcancelstate (int state, int *oldstate)
 Set the thread's cancellable state. More...
 

Detailed Description

Globus Threading Abstraction.

Globus threads package which can work with either pthreads or without threads, depending on runtime configuration