NAME

ACE_Thread - Provides a wrapper for threads.

SYNOPSIS

#include <ace/Thread.h >

class ACE_Thread { public: static int spawn ( ACE_THR_FUNC func, void *arg = 0, long flags = THR_NEW_LWP, ACE_thread_t *t_id = 0, ACE_hthread_t *t_handle = 0, long priority = ACE_DEFAULT_THREAD_PRIORITY, void *stack = 0, size_t stack_size = 0, ACE_Thread_Adapter *thread_adapter = 0 ); static int spawn_n ( size_t n, ACE_THR_FUNC func, void *arg = 0, long flags = THR_NEW_LWP, long priority = ACE_DEFAULT_THREAD_PRIORITY, void *stack[] = 0, size_t stack_size[] = 0, ACE_Thread_Adapter *thread_adapter = 0 ); static int spawn_n ( ACE_thread_t thread_ids[], size_t n, ACE_THR_FUNC func, void *arg, long flags, long priority = ACE_DEFAULT_THREAD_PRIORITY, void *stack[] = 0, size_t stack_size[] = 0, ACE_hthread_t thread_handles[] = 0, ACE_Thread_Adapter *thread_adapter = 0 ); static int join (const ACE_Thread_ID &, void **status = 0); static int join (ACE_thread_t, ACE_thread_t *, void **status = 0); static int join (ACE_hthread_t, void ** = 0); static int resume (ACE_hthread_t); static int suspend (ACE_hthread_t); static int getprio (ACE_hthread_t, int &prio); static int setprio (ACE_hthread_t, int prio); static int kill (ACE_thread_t, int signum); static void yield (void); static void self (ACE_hthread_t &t_handle); static ACE_thread_t self (void); static void exit (void *status = 0); static int getconcurrency (void); static int setconcurrency (int new_level); static int sigsetmask ( int how, const sigset_t *set, sigset_t *oset = 0 ); static int keycreate ( ACE_thread_key_t *keyp, ACE_THR_C_DEST destructor, ACE_THR_DEST destructor, void * = 0 ); static int keyfree (ACE_thread_key_t key); static int setspecific (ACE_thread_key_t key, void *value); static int getspecific (ACE_thread_key_t key, void **valuep); static int disablecancel (struct cancel_state *old_state); static int enablecancel ( struct cancel_state *old_state, int flag ); static int setcancelstate ( struct cancel_state &new_state, struct cancel_state *old_state ); static int cancel (ACE_thread_t t_id); static void testcancel (void); private: ACE_Thread (void); };

DESCRIPTION

This class provides a common interface that is mapped onto POSIX Pthreads, Solaris threads, Win32 threads, VxWorks threads, or pSoS threads. Note, however, that it is generally a better idea to use the ACE_Thread_Manager programming API rather than the ACE_Thread API since the thread manager is more powerful.

PUBLIC MEMBERS

static int spawn (
    ACE_THR_FUNC func,
    void *arg = 0,
    long flags = THR_NEW_LWP,
    ACE_thread_t *t_id = 0,
    ACE_hthread_t *t_handle = 0,
    long priority = ACE_DEFAULT_THREAD_PRIORITY,
    void *stack = 0,
    size_t stack_size = 0,
    ACE_Thread_Adapter *thread_adapter = 0
    );

static int spawn_n (
    size_t n,
    ACE_THR_FUNC func,
    void *arg = 0,
    long flags = THR_NEW_LWP,
    long priority = ACE_DEFAULT_THREAD_PRIORITY,
    void *stack[] = 0,
    size_t stack_size[] = 0,
    ACE_Thread_Adapter *thread_adapter = 0
    );

static int spawn_n (
    ACE_thread_t thread_ids[],
    size_t n,
    ACE_THR_FUNC func,
    void *arg,
    long flags,
    long priority = ACE_DEFAULT_THREAD_PRIORITY,
    void *stack[] = 0,
    size_t stack_size[] = 0,
    ACE_hthread_t thread_handles[] = 0,
    ACE_Thread_Adapter *thread_adapter = 0
    );

static int join (const ACE_Thread_ID &, void **status = 0);

static int join (ACE_thread_t, ACE_thread_t *, void **status = 0);

static int join (ACE_hthread_t, void ** = 0);

static int resume (ACE_hthread_t);

static int suspend (ACE_hthread_t);

static int getprio (ACE_hthread_t, int &prio);

static int setprio (ACE_hthread_t, int prio);

static int kill (ACE_thread_t, int signum);

static void yield (void);

static void self (ACE_hthread_t &t_handle);

static ACE_thread_t self (void);

static void exit (void *status = 0);

static int getconcurrency (void);

static int setconcurrency (int new_level);

static int sigsetmask (
    int how,
    const sigset_t *set,
    sigset_t *oset = 0
    );

static int keycreate (
    ACE_thread_key_t *keyp,
    ACE_THR_C_DEST destructor,
    ACE_THR_DEST destructor,
    void * = 0
    );

static int keyfree (ACE_thread_key_t key);

static int setspecific (ACE_thread_key_t key, void *value);

static int getspecific (ACE_thread_key_t key, void **valuep);

static int disablecancel (struct cancel_state *old_state);

static int enablecancel (struct cancel_state *old_state, int flag);

static int setcancelstate (
    struct cancel_state &new_state,
    struct cancel_state *old_state
    );

static int cancel (ACE_thread_t t_id);

static void testcancel (void);

PRIVATE MEMBERS

ACE_Thread (void);

AUTHOR

Doug Schmidt

LIBRARY

ace