---
name: "globus_thread.h"
section: "3"
platform: "linux"
package: "libglobus-common-doc"
version: "18.14-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/globus_thread.h"
---

# globus\_thread.h(3)

Globus Threading Abstraction.

## 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**\
 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**\
 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.
