# OS_NS_Thread.h File Reference

`#include "ace/config-all.h"`
`#include "ace/Global_Macros.h"`
`#include "ace/Basic_Types.h"`
`#include "ace/Default_Constants.h"`
`#include "ace/os_include/os_pthread.h"`
`#include "ace/os_include/os_sched.h"`
`#include "ace/Base_Thread_Adapter.h"`
`#include "ace/os_include/sys/os_sem.h"`
`#include "ace/os_include/os_semaphore.h"`
`#include "ace/OS_Memory.h"`
`#include "ace/OS_NS_signal.h"`
`#include "ace/ACE_export.h"`
`#include "ace/Object_Manager_Base.h"`
`#include "ace/OS_NS_Thread.inl"`

Include dependency graph for OS_NS_Thread.h:

This graph shows which files directly or indirectly include this file:

## Namespaces

namespace | ACE_OS

## Classes

class | ACE_recursive_thread_mutex_t
| Implement a thin C++ wrapper that allows nested acquisition and release of a mutex that occurs in the same thread. More...
struct | ACE_recursive_mutex_state
class | ACE_Thread_ID
| Defines a platform-independent thread ID class. Note that this class should be defined within the scope of a thread, rather than at global scope! More...
class | ACE_TSS_Ref
| "Reference count" for thread-specific storage keys. More...
class | ACE_TSS_Info
| Thread Specific Key management. More...
class | ACE_TSS_Keys
| Collection of in-use flags for a thread's TSS keys. For internal use only by ACE_TSS_Cleanup; it is public because some compilers can't use nested classes for template instantiation parameters. More...

## A set of wrappers for condition variables.

ACE_NAMESPACE_INLINE_FUNCTION int | condattr_init (ACE_condattr_t &attributes, int type=ACE_DEFAULT_SYNCH_TYPE)
ACE_NAMESPACE_INLINE_FUNCTION int | condattr_destroy (ACE_condattr_t &attributes)
ACE_NAMESPACE_INLINE_FUNCTION int | cond_broadcast (ACE_cond_t *cv)
ACE_NAMESPACE_INLINE_FUNCTION int | cond_destroy (ACE_cond_t *cv)
ACE_Export int | cond_init (ACE_cond_t *cv, short type=ACE_DEFAULT_SYNCH_TYPE, const char *name=0, void *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION int | cond_init (ACE_cond_t *cv, ACE_condattr_t &attributes, const char *name=0, void *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION int | cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION int | cond_init (ACE_cond_t *cv, ACE_condattr_t &attributes, const wchar_t *name, void *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION int | cond_signal (ACE_cond_t *cv)
ACE_NAMESPACE_INLINE_FUNCTION int | cond_timedwait (ACE_cond_t *cv, ACE_mutex_t *m, ACE_Time_Value *)
ACE_NAMESPACE_INLINE_FUNCTION int | cond_wait (ACE_cond_t *cv, ACE_mutex_t *m)

## A set of wrappers for auto-reset and manual events.

ACE_Export int | event_destroy (ACE_event_t *event)
ACE_Export int | event_init (ACE_event_t *event, int manual_reset=0, int initial_state=0, int type=ACE_DEFAULT_SYNCH_TYPE, const char *name=0, void *arg=0, LPSECURITY_ATTRIBUTES sa=0)
ACE_NAMESPACE_INLINE_FUNCTION int | event_init (ACE_event_t *event, int manual_reset, int initial_state, int type, const wchar_t *name, void *arg=0, LPSECURITY_ATTRIBUTES sa=0)
ACE_Export int | event_pulse (ACE_event_t *event)
ACE_Export int | event_reset (ACE_event_t *event)
ACE_Export int | event_signal (ACE_event_t *event)
ACE_Export int | event_timedwait (ACE_event_t *event, ACE_Time_Value *timeout, int use_absolute_time=1)
ACE_Export int | event_wait (ACE_event_t *event)

## A set of wrappers for mutex locks.

ACE_Export int | mutex_destroy (ACE_mutex_t *m)
ACE_Export int | mutex_init (ACE_mutex_t *m, int lock_scope=ACE_DEFAULT_SYNCH_TYPE, const char *name=0, ACE_mutexattr_t *arg=0, LPSECURITY_ATTRIBUTES sa=0, int lock_type=0)
ACE_Export int | mutex_init (ACE_mutex_t *m, int lock_scope, const wchar_t *name, ACE_mutexattr_t *arg=0, LPSECURITY_ATTRIBUTES sa=0, int lock_type=0)
ACE_Export int | mutex_lock (ACE_mutex_t *m)
ACE_Export int | mutex_lock (ACE_mutex_t *m, int &abandoned)
ACE_Export int | mutex_lock (ACE_mutex_t *m, const ACE_Time_Value &timeout)
ACE_NAMESPACE_INLINE_FUNCTION int | mutex_lock (ACE_mutex_t *m, const ACE_Time_Value *timeout)
ACE_Export void | mutex_lock_cleanup (void *mutex)
| Handle asynchronous thread cancellation cleanup.
ACE_Export int | mutex_trylock (ACE_mutex_t *m)
ACE_Export int | mutex_trylock (ACE_mutex_t *m, int &abandoned)
ACE_Export int | mutex_unlock (ACE_mutex_t *m)

## A set of wrappers for recursive mutex locks.

ACE_NAMESPACE_INLINE_FUNCTION int | recursive_mutex_cond_unlock (ACE_recursive_thread_mutex_t *m, ACE_recursive_mutex_state &state)
ACE_NAMESPACE_INLINE_FUNCTION void | recursive_mutex_cond_relock (ACE_recursive_thread_mutex_t *m, ACE_recursive_mutex_state &state)
ACE_NAMESPACE_INLINE_FUNCTION int | recursive_mutex_destroy (ACE_recursive_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION int | recursive_mutex_init (ACE_recursive_thread_mutex_t *m, const ACE_TCHAR *name=0, ACE_mutexattr_t *arg=0, LPSECURITY_ATTRIBUTES sa=0)
ACE_NAMESPACE_INLINE_FUNCTION int | recursive_mutex_lock (ACE_recursive_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION int | recursive_mutex_trylock (ACE_recursive_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION int | recursive_mutex_unlock (ACE_recursive_thread_mutex_t *m)

## A set of wrappers for readers/writer locks.

ACE_NAMESPACE_INLINE_FUNCTION int | rw_rdlock (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION int | rw_tryrdlock (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION int | rw_trywrlock (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION int | rw_trywrlock_upgrade (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION int | rw_unlock (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION int | rw_wrlock (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION int | rwlock_destroy (ACE_rwlock_t *rw)
ACE_Export int | rwlock_init (ACE_rwlock_t *rw, int type=ACE_DEFAULT_SYNCH_TYPE, const ACE_TCHAR *name=0, void *arg=0)

## Thread scheduler interface.

ACE_Export int | sched_params (const ACE_Sched_Params &, ACE_id_t id=ACE_SELF)

## A set of wrappers for semaphores.

ACE_NAMESPACE_INLINE_FUNCTION int | sema_destroy (ACE_sema_t *s)
ACE_NAMESPACE_INLINE_FUNCTION int | sema_init (ACE_sema_t *s, u_int count, int type=ACE_DEFAULT_SYNCH_TYPE, const char *name=0, void *arg=0, int max=0x7fffffff, LPSECURITY_ATTRIBUTES sa=0)
ACE_NAMESPACE_INLINE_FUNCTION int | sema_init (ACE_sema_t *s, u_int count, int type, const wchar_t *name, void *arg=0, int max=0x7fffffff, LPSECURITY_ATTRIBUTES sa=0)
ACE_NAMESPACE_INLINE_FUNCTION int | sema_post (ACE_sema_t *s)
ACE_NAMESPACE_INLINE_FUNCTION int | sema_post (ACE_sema_t *s, u_int release_count)
ACE_NAMESPACE_INLINE_FUNCTION int | sema_trywait (ACE_sema_t *s)
ACE_NAMESPACE_INLINE_FUNCTION int | sema_wait (ACE_sema_t *s)
ACE_NAMESPACE_INLINE_FUNCTION int | sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
ACE_NAMESPACE_INLINE_FUNCTION int | sema_wait (ACE_sema_t *s, ACE_Time_Value *tv)

## A set of wrappers for System V semaphores.

ACE_NAMESPACE_INLINE_FUNCTION int | semctl (int int_id, int semnum, int cmd, semun)
ACE_NAMESPACE_INLINE_FUNCTION int | semget (key_t key, int nsems, int flags)
ACE_NAMESPACE_INLINE_FUNCTION int | semop (int int_id, struct sembuf *sops, size_t nsops)

## A set of wrappers for mutex locks that only work within a single process.

ACE_NAMESPACE_INLINE_FUNCTION int | thread_mutex_destroy (ACE_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION int | thread_mutex_init (ACE_thread_mutex_t *m, int lock_type=0, const char *name=0, ACE_mutexattr_t *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION int | thread_mutex_init (ACE_thread_mutex_t *m, int lock_type, const wchar_t *name, ACE_mutexattr_t *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION int | thread_mutex_lock (ACE_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION int | thread_mutex_lock (ACE_thread_mutex_t *m, const ACE_Time_Value &timeout)
ACE_NAMESPACE_INLINE_FUNCTION int | thread_mutex_lock (ACE_thread_mutex_t *m, const ACE_Time_Value *timeout)
ACE_NAMESPACE_INLINE_FUNCTION int | thread_mutex_trylock (ACE_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION int | thread_mutex_unlock (ACE_thread_mutex_t *m)

## A set of wrappers for threads

ACE_Export ACE_thread_t | NULL_thread
ACE_Export ACE_hthread_t | NULL_hthread
ACE_Export ACE_thread_key_t | NULL_key

## Defines

#define | ACE_EXPORT_MACRO ACE_Export
#define | ACE_SCOPE_PROCESS 0
#define | ACE_SCOPE_LWP 1
#define | ACE_SCOPE_THREAD 2
#define | ACE_SCHED_OTHER 0
#define | ACE_SCHED_FIFO 1
#define | ACE_SCHED_RR 2
#define | ACE_THR_PRI_FIFO_DEF 0
#define | ACE_THR_PRI_OTHER_DEF 0
#define | ACE_DEFAULT_SYNCH_TYPE USYNC_THREAD
#define | ACE_SELF (0)
#define | ACE_KEY_INDEX(OBJ, KEY) u_int OBJ = KEY
#define | ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME ace_mutex_lock_cleanup_adapter
#define | ACE_PTHREAD_CLEANUP_PUSH(A)
#define | ACE_PTHREAD_CLEANUP_POP(A)
#define | ACE_OS_GUARD
#define | ACE_TSS_CLEANUP_GUARD
#define | ACE_TSS_BASE_GUARD
#define | ACE_INLINE inline

## Typedefs

typedef HANDLE | ACE_hthread_t
typedef DWORD | ACE_OS_thread_key_t
typedef ACE_OS_thread_key_t | ACE_thread_key_t
typedef int | ACE_Sched_Priority
typedef int | ACE_idtype_t
typedef DWORD | ACE_id_t
typedef int | ACE_pri_t

## Functions

ACE_Export void | cleanup_tss (const u_int main_thread)
ACE_Export int | lwp_getparams (ACE_Sched_Params &)
ACE_Export int | lwp_setparams (const ACE_Sched_Params &)
ACE_NAMESPACE_INLINE_FUNCTION long | priority_control (ACE_idtype_t, ACE_id_t, int, void *)
| Low-level interface to <priocntl>(2).
ACE_Export int | scheduling_class (const char *class_name, ACE_id_t &)
| Find the schedling class ID that corresponds to the class name.
ACE_Export int | set_scheduling_params (const ACE_Sched_Params &, ACE_id_t id=ACE_SELF)
| Friendly interface to <priocntl>(2).
ACE_NAMESPACE_INLINE_FUNCTION int | sigtimedwait (const sigset_t *set, siginfo_t *info, const ACE_Time_Value *timeout)
ACE_NAMESPACE_INLINE_FUNCTION int | sigwait (sigset_t *set, int *sig=0)
ACE_NAMESPACE_INLINE_FUNCTION int | sigwaitinfo (const sigset_t *set, siginfo_t *info)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_cancel (ACE_thread_t t_id)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_cmp (ACE_hthread_t t1, ACE_hthread_t t2)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_continue (ACE_hthread_t target_thread)
ACE_Export int | thr_create (ACE_THR_FUNC func, void *args, long flags, ACE_thread_t *thr_id, ACE_hthread_t *t_handle=0, long priority=ACE_DEFAULT_THREAD_PRIORITY, void *stack=0, size_t stacksize=0, ACE_Base_Thread_Adapter *thread_adapter=0)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_equal (ACE_thread_t t1, ACE_thread_t t2)
ACE_Export void | thr_exit (ACE_THR_FUNC_RETURN status=0)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_getconcurrency (void)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_getprio (ACE_hthread_t id, int &priority)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_getprio (ACE_hthread_t id, int &priority, int &policy)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_getspecific (ACE_thread_key_t key, void **data)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_join (ACE_hthread_t waiter_id, ACE_THR_FUNC_RETURN *status)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_join (ACE_thread_t waiter_id, ACE_thread_t *thr_id, ACE_THR_FUNC_RETURN *status)
ACE_Export int | thr_get_affinity (ACE_hthread_t id, size_t cpu_set_size, cpu_set_t *cpu_mask)
ACE_Export int | thr_set_affinity (ACE_hthread_t thr_id, size_t cpu_set_size, const cpu_set_t *cpu_mask)
ACE_Export int | thr_key_detach (ACE_thread_key_t key, void *inst)
ACE_Export int | thr_key_used (ACE_thread_key_t key)
ACE_Export int | thr_keycreate (ACE_thread_key_t *key, ACE_THR_DEST, void *inst=0)
ACE_Export int | thr_keyfree (ACE_thread_key_t key)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_kill (ACE_thread_t thr_id, int signum)
ACE_NAMESPACE_INLINE_FUNCTION size_t | thr_min_stack (void)
ACE_NAMESPACE_INLINE_FUNCTION ACE_thread_t | thr_self (void)
ACE_NAMESPACE_INLINE_FUNCTION void | thr_self (ACE_hthread_t &)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_setcancelstate (int new_state, int *old_state)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_setcanceltype (int new_type, int *old_type)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_setconcurrency (int hint)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_setprio (ACE_hthread_t ht_id, int priority, int policy=-1)
ACE_Export int | thr_setprio (const ACE_Sched_Priority prio)
ACE_Export int | thr_setspecific (ACE_thread_key_t key, void *data)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_sigsetmask (int how, const sigset_t *nsm, sigset_t *osm)
ACE_NAMESPACE_INLINE_FUNCTION int | thr_suspend (ACE_hthread_t target_thread)
ACE_NAMESPACE_INLINE_FUNCTION void | thr_testcancel (void)
ACE_NAMESPACE_INLINE_FUNCTION void | thr_yield (void)
ACE_Export void | unique_name (const void *object, char *name, size_t length)

## Variables

ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef DWORD | ACE_thread_t

## Detailed Description

Id
  OS_NS_Thread.h,v 1.54 2006/02/02 21:36:53 ossama Exp

Author:
  Douglas C. Schmidt <schmidt@cs.wustl.edu>

  Jesper S. M|ller<stophph@diku.dk>

  and a cast of thousands...

Originally in OS.h.

## Define Documentation

#define ACE_DEFAULT_SYNCH_TYPE USYNC_THREAD

#define ACE_EXPORT_MACRO ACE_Export

#define ACE_INLINE inline

#define ACE_KEY_INDEX | ( | OBJ,
|  | KEY |  | ) | u_int OBJ = KEY

#define ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME ace_mutex_lock_cleanup_adapter

#define ACE_OS_GUARD

#define ACE_PTHREAD_CLEANUP_POP | ( | A |  | ) |

#define ACE_PTHREAD_CLEANUP_PUSH | ( | A |  | ) |

#define ACE_SCHED_FIFO 1

#define ACE_SCHED_OTHER 0

#define ACE_SCHED_RR 2

#define ACE_SCOPE_LWP 1

#define ACE_SCOPE_PROCESS 0

#define ACE_SCOPE_THREAD 2

#define ACE_SELF (0)

#define ACE_THR_PRI_FIFO_DEF 0

#define ACE_THR_PRI_OTHER_DEF 0

#define ACE_TSS_BASE_GUARD

#define ACE_TSS_CLEANUP_GUARD

## Typedef Documentation

typedef HANDLE ACE_hthread_t

typedef DWORD ACE_id_t

typedef int ACE_idtype_t

typedef DWORD ACE_OS_thread_key_t

typedef int ACE_pri_t

typedef int ACE_Sched_Priority

typedef ACE_OS_thread_key_t ACE_thread_key_t

## Function Documentation

void ACE_OS::cleanup_tss | ( | const u_int | main_thread | ) |

| Call TSS destructors for the current thread. If the current thread is the main thread, then the argument must be 1. For private use of ACE_Object_Manager and ACE_Thread_Adapter only.

ACE_INLINE int ACE_OS::cond_broadcast | ( | ACE_cond_t * | cv | ) |

ACE_INLINE int ACE_OS::cond_destroy | ( | ACE_cond_t * | cv | ) |

ACE_INLINE int ACE_OS::cond_init | ( | ACE_cond_t * | cv,
|  | ACE_condattr_t & | attributes,
|  | const wchar_t * | name,
|  | void * | arg = `0`
| ) |

ACE_INLINE int ACE_OS::cond_init | ( | ACE_cond_t * | cv,
|  | short | type,
|  | const wchar_t * | name,
|  | void * | arg = `0`
| ) |

ACE_INLINE int ACE_OS::cond_init | ( | ACE_cond_t * | cv,
|  | ACE_condattr_t & | attributes,
|  | const char * | name = `0`,
|  | void * | arg = `0`
| ) |

int ACE_OS::cond_init | ( | ACE_cond_t * | cv,
|  | short | type = `ACE_DEFAULT_SYNCH_TYPE`,
|  | const char * | name = `0`,
|  | void * | arg = `0`
| ) |

ACE_INLINE int ACE_OS::cond_signal | ( | ACE_cond_t * | cv | ) |

ACE_INLINE int ACE_OS::cond_timedwait | ( | ACE_cond_t * | cv,
|  | ACE_mutex_t * | m,
|  | ACE_Time_Value * |
| ) |

ACE_INLINE int ACE_OS::cond_wait | ( | ACE_cond_t * | cv,
|  | ACE_mutex_t * | m
| ) |

ACE_INLINE int ACE_OS::condattr_destroy | ( | ACE_condattr_t & | attributes | ) |

ACE_INLINE int ACE_OS::condattr_init | ( | ACE_condattr_t & | attributes,
|  | int | type = `ACE_DEFAULT_SYNCH_TYPE`
| ) |

int ACE_OS::event_destroy | ( | ACE_event_t * | event | ) |

ACE_INLINE int ACE_OS::event_init | ( | ACE_event_t * | event,
|  | int | manual_reset,
|  | int | initial_state,
|  | int | type,
|  | const wchar_t * | name,
|  | void * | arg = `0`,
|  | LPSECURITY_ATTRIBUTES | sa = `0`
| ) |

int ACE_OS::event_init | ( | ACE_event_t * | event,
|  | int | manual_reset = `0`,
|  | int | initial_state = `0`,
|  | int | type = `ACE_DEFAULT_SYNCH_TYPE`,
|  | const char * | name = `0`,
|  | void * | arg = `0`,
|  | LPSECURITY_ATTRIBUTES | sa = `0`
| ) |

int ACE_OS::event_pulse | ( | ACE_event_t * | event | ) |

int ACE_OS::event_reset | ( | ACE_event_t * | event | ) |

int ACE_OS::event_signal | ( | ACE_event_t * | event | ) |

int ACE_OS::event_timedwait | ( | ACE_event_t * | event,
|  | ACE_Time_Value * | timeout,
|  | int | use_absolute_time = `1`
| ) |

int ACE_OS::event_wait | ( | ACE_event_t * | event | ) |

int ACE_OS::lwp_getparams | ( | ACE_Sched_Params & |  | ) |

int ACE_OS::lwp_setparams | ( | const ACE_Sched_Params & |  | ) |

int ACE_OS::mutex_destroy | ( | ACE_mutex_t * | m | ) |

int ACE_OS::mutex_init | ( | ACE_mutex_t * | m,
|  | int | lock_scope,
|  | const wchar_t * | name,
|  | ACE_mutexattr_t * | arg = `0`,
|  | LPSECURITY_ATTRIBUTES | sa = `0`,
|  | int | lock_type = `0`
| ) |

int ACE_OS::mutex_init | ( | ACE_mutex_t * | m,
|  | int | lock_scope = `ACE_DEFAULT_SYNCH_TYPE`,
|  | const char * | name = `0`,
|  | ACE_mutexattr_t * | arg = `0`,
|  | LPSECURITY_ATTRIBUTES | sa = `0`,
|  | int | lock_type = `0`
| ) |

ACE_INLINE int ACE_OS::mutex_lock | ( | ACE_mutex_t * | m,
|  | const ACE_Time_Value * | timeout
| ) |

If <timeout> == 0, calls <ACE_OS::mutex_lock(m)>. Otherwise, this method attempts to acquire a lock, but gives up if the lock has not been acquired by the given time, in which case it returns -1 with an <etime> errno on platforms that actually support timed mutexes. The timeout should be an absolute time. Note that the mutex should not be a recursive one, i.e., it should only be a standard mutex or an error checking mutex.

int ACE_OS::mutex_lock | ( | ACE_mutex_t * | m,
|  | const ACE_Time_Value & | timeout
| ) |

This method attempts to acquire a lock, but gives up if the lock has not been acquired by the given time. If the lock is not acquired within the given amount of time, then this method returns -1 with an <etime> errno on platforms that actually support timed mutexes. The timeout should be an absolute time. Note that the mutex should not be a recursive one, i.e., it should only be a standard mutex or an error checking mutex.

int ACE_OS::mutex_lock | ( | ACE_mutex_t * | m,
|  | int & | abandoned
| ) |

| This method is only implemented for Win32. For abandoned mutexes, <abandoned> is set to 1 and 0 is returned.

int ACE_OS::mutex_lock | ( | ACE_mutex_t * | m | ) |

| Win32 note: Abandoned mutexes are not treated differently. 0 is returned since the calling thread does get the ownership.

void ACE_OS::mutex_lock_cleanup | ( | void * | mutex | ) |

| Handle asynchronous thread cancellation cleanup.

int ACE_OS::mutex_trylock | ( | ACE_mutex_t * | m,
|  | int & | abandoned
| ) |

| This method is only implemented for Win32. For abandoned mutexes, <abandoned> is set to 1 and 0 is returned.

int ACE_OS::mutex_trylock | ( | ACE_mutex_t * | m | ) |

| Win32 note: Abandoned mutexes are not treated differently. 0 is returned since the calling thread does get the ownership.

int ACE_OS::mutex_unlock | ( | ACE_mutex_t * | m | ) |

ACE_INLINE long ACE_OS::priority_control | ( | ACE_idtype_t | ,
|  | ACE_id_t | ,
|  | int | ,
|  | void * |
| ) |

| Low-level interface to <priocntl>(2). Can't call the following priocntl, because that's a macro on Solaris.

ACE_INLINE void ACE_OS::recursive_mutex_cond_relock | ( | ACE_recursive_thread_mutex_t * | m,
|  | ACE_recursive_mutex_state & | state
| ) |

ACE_INLINE int ACE_OS::recursive_mutex_cond_unlock | ( | ACE_recursive_thread_mutex_t * | m,
|  | ACE_recursive_mutex_state & | state
| ) |

ACE_INLINE int ACE_OS::recursive_mutex_destroy | ( | ACE_recursive_thread_mutex_t * | m | ) |

ACE_INLINE int ACE_OS::recursive_mutex_init | ( | ACE_recursive_thread_mutex_t * | m,
|  | const ACE_TCHAR * | name = `0`,
|  | ACE_mutexattr_t * | arg = `0`,
|  | LPSECURITY_ATTRIBUTES | sa = `0`
| ) |

ACE_INLINE int ACE_OS::recursive_mutex_lock | ( | ACE_recursive_thread_mutex_t * | m | ) |

ACE_INLINE int ACE_OS::recursive_mutex_trylock | ( | ACE_recursive_thread_mutex_t * | m | ) |

ACE_INLINE int ACE_OS::recursive_mutex_unlock | ( | ACE_recursive_thread_mutex_t * | m | ) |

ACE_INLINE int ACE_OS::rw_rdlock | ( | ACE_rwlock_t * | rw | ) |

ACE_INLINE int ACE_OS::rw_tryrdlock | ( | ACE_rwlock_t * | rw | ) |

ACE_INLINE int ACE_OS::rw_trywrlock | ( | ACE_rwlock_t * | rw | ) |

ACE_INLINE int ACE_OS::rw_trywrlock_upgrade | ( | ACE_rwlock_t * | rw | ) |

ACE_INLINE int ACE_OS::rw_unlock | ( | ACE_rwlock_t * | rw | ) |

ACE_INLINE int ACE_OS::rw_wrlock | ( | ACE_rwlock_t * | rw | ) |

ACE_INLINE int ACE_OS::rwlock_destroy | ( | ACE_rwlock_t * | rw | ) |

ACE_INLINE int ACE_OS::rwlock_init | ( | ACE_rwlock_t * | rw,
|  | int | type = `ACE_DEFAULT_SYNCH_TYPE`,
|  | const ACE_TCHAR * | name = `0`,
|  | void * | arg = `0`
| ) |

int ACE_OS::sched_params | ( | const ACE_Sched_Params & | ,
|  | ACE_id_t | id = `ACE_SELF`
| ) |

| Set scheduling parameters. An id of ACE_SELF indicates, e.g., set the parameters on the calling thread.

int ACE_OS::scheduling_class | ( | const char * | class_name,
|  | ACE_id_t & |
| ) |

| Find the schedling class ID that corresponds to the class name.

ACE_INLINE int ACE_OS::sema_destroy | ( | ACE_sema_t * | s | ) |

ACE_INLINE int ACE_OS::sema_init | ( | ACE_sema_t * | s,
|  | u_int | count,
|  | int | type,
|  | const wchar_t * | name,
|  | void * | arg = `0`,
|  | int | max = `0x7fffffff`,
|  | LPSECURITY_ATTRIBUTES | sa = `0`
| ) |

ACE_INLINE int ACE_OS::sema_init | ( | ACE_sema_t * | s,
|  | u_int | count,
|  | int | type = `ACE_DEFAULT_SYNCH_TYPE`,
|  | const char * | name = `0`,
|  | void * | arg = `0`,
|  | int | max = `0x7fffffff`,
|  | LPSECURITY_ATTRIBUTES | sa = `0`
| ) |

ACE_INLINE int ACE_OS::sema_post | ( | ACE_sema_t * | s,
|  | u_int | release_count
| ) |

ACE_INLINE int ACE_OS::sema_post | ( | ACE_sema_t * | s | ) |

ACE_INLINE int ACE_OS::sema_trywait | ( | ACE_sema_t * | s | ) |

ACE_INLINE int ACE_OS::sema_wait | ( | ACE_sema_t * | s,
|  | ACE_Time_Value * | tv
| ) |

ACE_INLINE int ACE_OS::sema_wait | ( | ACE_sema_t * | s,
|  | ACE_Time_Value & | tv
| ) |

ACE_INLINE int ACE_OS::sema_wait | ( | ACE_sema_t * | s | ) |

ACE_INLINE int ACE_OS::semctl | ( | int | int_id,
|  | int | semnum,
|  | int | cmd,
|  | semun |
| ) |

ACE_INLINE int ACE_OS::semget | ( | key_t | key,
|  | int | nsems,
|  | int | flags
| ) |

ACE_INLINE int ACE_OS::semop | ( | int | int_id,
|  | struct sembuf * | sops,
|  | size_t | nsops
| ) |

int ACE_OS::set_scheduling_params | ( | const ACE_Sched_Params & | ,
|  | ACE_id_t | id = `ACE_SELF`
| ) |

| Friendly interface to <priocntl>(2).

ACE_INLINE int ACE_OS::sigtimedwait | ( | const sigset_t * | set,
|  | siginfo_t * | info,
|  | const ACE_Time_Value * | timeout
| ) |

ACE_INLINE int ACE_OS::sigwait | ( | sigset_t * | set,
|  | int * | sig = `0`
| ) |

ACE_INLINE int ACE_OS::sigwaitinfo | ( | const sigset_t * | set,
|  | siginfo_t * | info
| ) |

ACE_INLINE int ACE_OS::thr_cancel | ( | ACE_thread_t | t_id | ) |

ACE_INLINE int ACE_OS::thr_cmp | ( | ACE_hthread_t | t1,
|  | ACE_hthread_t | t2
| ) |

ACE_INLINE int ACE_OS::thr_continue | ( | ACE_hthread_t | target_thread | ) |

int ACE_OS::thr_create | ( | ACE_THR_FUNC | func,
|  | void * | args,
|  | long | flags,
|  | ACE_thread_t * | thr_id,
|  | ACE_hthread_t * | t_handle = `0`,
|  | long | priority = `ACE_DEFAULT_THREAD_PRIORITY`,
|  | void * | stack = `0`,
|  | size_t | stacksize = `0`,
|  | ACE_Base_Thread_Adapter * | thread_adapter = `0`
| ) |

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_OS::thr_equal | ( | ACE_thread_t | t1,
|  | ACE_thread_t | t2
| ) |

void ACE_OS::thr_exit | ( | ACE_THR_FUNC_RETURN | status = `0` | ) |

int ACE_OS::thr_get_affinity | ( | ACE_hthread_t | id,
|  | size_t | cpu_set_size,
|  | cpu_set_t * | cpu_mask
| ) |

Get the thread affinity

Parameters:

  | thr_id | For NPTL-threads, when ACE_HAS_PTHREAD_SETAFFINITY_NP defined, this is the thread-id. For linux-threads, when ACE_HAS_SCHED_SETAFFINITY defined, it expects a process-id. Since for linux-threads a thread is seen as a process, it does the job.
  | cpu_set_size | The size of the cpu_mask
  | cpu_mask | Is a bitmask of CPUs to bind to, e.g value 1 binds the thread to the "CPU 0", etc

ACE_INLINE int ACE_OS::thr_getconcurrency | ( | void |  | ) |

ACE_INLINE int ACE_OS::thr_getprio | ( | ACE_hthread_t | id,
|  | int & | priority,
|  | int & | policy
| ) |

ACE_INLINE int ACE_OS::thr_getprio | ( | ACE_hthread_t | id,
|  | int & | priority
| ) |

ACE_INLINE int ACE_OS::thr_getspecific | ( | ACE_thread_key_t | key,
|  | void ** | data
| ) |

ACE_INLINE int ACE_OS::thr_join | ( | ACE_thread_t | waiter_id,
|  | ACE_thread_t * | thr_id,
|  | ACE_THR_FUNC_RETURN * | status
| ) |

ACE_INLINE int ACE_OS::thr_join | ( | ACE_hthread_t | waiter_id,
|  | ACE_THR_FUNC_RETURN * | status
| ) |

int ACE_OS::thr_key_detach | ( | ACE_thread_key_t | key,
|  | void * | inst
| ) |

Note:
  the "inst" arg is deprecated. It will be ignored.

int ACE_OS::thr_key_used | ( | ACE_thread_key_t | key | ) |

int ACE_OS::thr_keycreate | ( | ACE_thread_key_t * | key,
|  | ACE_THR_DEST | ,
|  | void * | inst = `0`
| ) |

Note:
  the "inst" arge is deprecated. It will be ignored.

int ACE_OS::thr_keyfree | ( | ACE_thread_key_t | key | ) |

ACE_INLINE int ACE_OS::thr_kill | ( | ACE_thread_t | thr_id,
|  | int | signum
| ) |

ACE_INLINE size_t ACE_OS::thr_min_stack | ( | void |  | ) |

ACE_INLINE void ACE_OS::thr_self | ( | ACE_hthread_t & |  | ) |

ACE_INLINE ACE_thread_t ACE_OS::thr_self | ( | void |  | ) |

int ACE_OS::thr_set_affinity | ( | ACE_hthread_t | thr_id,
|  | size_t | cpu_set_size,
|  | const cpu_set_t * | cpu_mask
| ) |

Set the thread affinity

Parameters:

  | thr_id | For NPTL-threads, when ACE_HAS_PTHREAD_SETAFFINITY_NP defined, this is the thread-id. For linux-threads, when ACE_HAS_SCHED_SETAFFINITY defined, it expects a process-id. Since for linux-threads a thread is seen as a process, it does the job.
  | cpu_set_size | The size of the cpu_mask
  | cpu_mask | Is a bitmask of CPUs to bind to, e.g value 1 binds the thread to the "CPU 0", etc

ACE_INLINE int ACE_OS::thr_setcancelstate | ( | int | new_state,
|  | int * | old_state
| ) |

ACE_INLINE int ACE_OS::thr_setcanceltype | ( | int | new_type,
|  | int * | old_type
| ) |

ACE_INLINE int ACE_OS::thr_setconcurrency | ( | int | hint | ) |

int ACE_OS::thr_setprio | ( | const ACE_Sched_Priority | prio | ) |

ACE_INLINE int ACE_OS::thr_setprio | ( | ACE_hthread_t | ht_id,
|  | int | priority,
|  | int | policy = `-1`
| ) |

int ACE_OS::thr_setspecific | ( | ACE_thread_key_t | key,
|  | void * | data
| ) |

ACE_INLINE int ACE_OS::thr_sigsetmask | ( | int | how,
|  | const sigset_t * | nsm,
|  | sigset_t * | osm
| ) |

ACE_INLINE int ACE_OS::thr_suspend | ( | ACE_hthread_t | target_thread | ) |

ACE_INLINE void ACE_OS::thr_testcancel | ( | void |  | ) |

ACE_INLINE void ACE_OS::thr_yield | ( | void |  | ) |

ACE_INLINE int ACE_OS::thread_mutex_destroy | ( | ACE_thread_mutex_t * | m | ) |

ACE_INLINE int ACE_OS::thread_mutex_init | ( | ACE_thread_mutex_t * | m,
|  | int | lock_type,
|  | const wchar_t * | name,
|  | ACE_mutexattr_t * | arg = `0`
| ) |

ACE_INLINE int ACE_OS::thread_mutex_init | ( | ACE_thread_mutex_t * | m,
|  | int | lock_type = `0`,
|  | const char * | name = `0`,
|  | ACE_mutexattr_t * | arg = `0`
| ) |

ACE_INLINE int ACE_OS::thread_mutex_lock | ( | ACE_thread_mutex_t * | m,
|  | const ACE_Time_Value * | timeout
| ) |

ACE_INLINE int ACE_OS::thread_mutex_lock | ( | ACE_thread_mutex_t * | m,
|  | const ACE_Time_Value & | timeout
| ) |

ACE_INLINE int ACE_OS::thread_mutex_lock | ( | ACE_thread_mutex_t * | m | ) |

ACE_INLINE int ACE_OS::thread_mutex_trylock | ( | ACE_thread_mutex_t * | m | ) |

ACE_INLINE int ACE_OS::thread_mutex_unlock | ( | ACE_thread_mutex_t * | m | ) |

void ACE_OS::unique_name | ( | const void * | object,
|  | char * | name,
|  | size_t | length
| ) |

| This method uses process id and object pointer to come up with a machine wide unique name. The process ID will provide uniqueness between processes on the same machine. The "this" pointer of the <object> will provide uniqueness between other "live" objects in the same process. The uniqueness of this name is therefore only valid for the life of <object>.

## Variable Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef DWORD ACE_thread_t

ACE_hthread_t ACE_OS::NULL_hthread

| This is necessary to deal with POSIX pthreads and their use of structures for thread handles.

ACE_thread_key_t ACE_OS::NULL_key

| This is necessary to deal with POSIX pthreads and their use of structures for TSS keys.

ACE_thread_t ACE_OS::NULL_thread

| This is necessary to deal with POSIX pthreads and their use of structures for thread ids.