Thread-Related Functions


These functions provide a portable thread API that is loosely based on the POSIX standard 1003.1 (more commonly called Pthreads). This API is supported on all operating systems with kernel-level threads.

Thread Functions

The TutThread* functions manipulate threads.

TutThreadCreate — create a thread

T_THREAD TutThreadCreate(thread_func, thread_arg, ...) 
T_THREAD_FUNC thread_func; 
T_PTR thread_arg; 

TutThreadCreateVa — create a thread (va_list version)

T_THREAD TutThreadCreateVa(thread_func, thread_arg, var_arg_list) 
T_THREAD_FUNC thread_func; 
T_PTR thread_arg; 
va_list var_arg_list; 

TutThreadDetach — allow a thread to run to completion without requiring the operating system to remember its exit code

T_THREAD TutThreadDetach(thread_func, thread_arg, var_arg_list) 
T_THREAD_FUNC thread_func; 
T_PTR thread_arg; 
va_list var_arg_list; 

TutThreadEqual — compare two thread handles for equality

T_BOOL TutThreadEqual(thread_1, thread_2) 
T_THREAD thread_1; 
T_THREAD thread_2; 

TutThreadExit — exit from a thread

void TutThreadExit(exit_code) 
T_PTR exit_code; 

TutThreadSelf — return the T_THREAD of the current thread

T_THREAD TutThreadSelf() 

TutThreadWait — wait for another thread to exit

T_BOOL TutThreadWait(thread, exit_return) 
T_THREAD thread; 
T_PTR *exit_return; 

Mutex Functions

The TutMutex* functions manipulate mutual exclusion synchronization (mutex) objects.

TutMutexCreate — create a mutex object

T_MUTEX TutMutexCreate(initial_state) 
T_BOOL initial_state; 

TutMutexCreateFast — create a high-performance mutex object

T_MUTEX TutMutexCreateFast(initial_state) 
T_BOOL initial_state; 

TutMutexDestroy — destroy a mutex object

T_BOOL TutMutexDestroy(mutex) 
T_MUTEX mutex; 

TutMutexLock — lock a mutex object

T_BOOL TutMutexLock(mutex, timeout) 
T_MUTEX mutex; 
T_REAL8 timeout; 

TutMutexLockFast — lock a high-performance mutex object

T_BOOL TutMutexLockFast(mutex) 
T_MUTEX mutex; 

TutMutexUnlock — unlock a mutex object

T_BOOL TutMutexUnlock(mutex) 
T_MUTEX mutex; 

Condition Variable Functions

The TutCond* functions manipulate condition variable synchronization objects.

TutCondCreate — create a condition variable

T_COND TutCondCreate() 

TutCondDestroy — destroy a condition variable

T_BOOL TutCondDestroy(cond) 
T_COND cond; 

TutCondWait — wait to be awakened by a condition variable

T_BOOL TutCondWait(cond, mutex, timeout) 
T_COND cond; 
T_MUTEX mutex; 
T_REAL8 timeout; 

TutCondWakeAll — wake all threads waiting for a condition variable

T_BOOL TutCondWakeAll(cond) 
T_COND cond; 

Read/Write Mutex Functions

The TutRwMutex* functions manipulate read and write mutex synchronization objects.

TutRwMutexCreate — create a multiple-reader/single-writer mutex

T_RW_MUTEX TutRwMutexCreate(initial_state, read_quota) 
T_BOOL initial_state; 
T_INT4 read_quota; 

TutRwMutexDestroy — destroy a multiple-reader/single-writer mutex

T_BOOL TutRwMutexDestroy(rw_mu) 

TutRwMutexGetReadQuota — determine the current simultaneous reader quota of a read or write mutex

T_BOOL TutRwMutexGetReadQuota(rw_mutex, read_quota_return) 
T_RW_MUTEX rw_mutex; 
T_INT4 *read_quota_return; 

TutRwMutexReadLock — read-lock a read or write mutex

T_BOOL TutRwMutexReadLock(rw_mutex) 
T_RW_MUTEX rw_mutex; 

TutRwMutexReadLocked — check to see if a read or write mutex is read-locked by the current thread

T_BOOL TutRwMutexReadLocked(rw_mutex) 
T_RW_MUTEX rw_mutex; 

TutRwMutexSetReadQuota — set the simultaneous reader quota of a read or write mutex

T_BOOL TutRwMutexSetReadQuota(rw_mutex, read_quota) 
T_RW_MUTEX rw_mutex; 
T_INT4 read_quota; 

TutRwMutexUnlock — release a lock on a read or write mutex

T_BOOL TutRwMutexUnlock(rw_mutex) 
T_RW_MUTEX rw_mutex; 

TutRwMutexUpgradeLock — upgrade a read-lock on a read or write mutex to a write-lock

T_BOOL TutRwMutexUpgradeLock(rw_mutex, timeout) 
T_RW_MUTEX rw_mutex; 
T_REAL8 timeout; 

TutRwMutexWriteLock — write-lock a read or write mutex

T_BOOL TutRwMutexWriteLock(rw_mutex) 
T_RW_MUTEX rw_mutex; 

TutRwMutexWriteLocked — check to see if a read or write mutex is write-locked by the current thread

T_BOOL TutRwMutexWriteLocked(rw_mutex) 
T_RW_MUTEX rw_mutex; 

Thread-Specific Data Functions

The TutTsd* functions manipulate thread-specific data.

TutTsdGetValue — determine the value of a thread-specific data key

T_BOOL TutTsdGetValue(key, value_return) 
T_TSD_KEY key; 
T_PTR *value_return; 

TutTsdKeyCreate — create a thread-specific data key

T_BOOL TutTsdKeyCreate(key_return, destructor_func) 
T_TSD_KEY *key_return; 
T_TSD_KEY_DESTRUCTOR_FUNC destructor_func; 

TutTsdKeyDestroy — destroy a thread-specific data key

T_BOOL TutTsdKeyDestroy(key) 
T_TSD_KEY key; 

TutTsdSetValue — set the value of a thread-specific data key

T_BOOL TutTsdSetValue(key, value) 
T_TSD_KEY key; 
T_PTR value; 

TIBCO SmartSockets™ API Quick Reference
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com