cthread.c File Reference

#include <signal.h>
#include <cybergarage/util/cthread.h>
#include <cybergarage/util/ctime.h>
#include <cybergarage/util/clog.h>
#include <string.h>

Functions

static void sig_handler (int sign)
static void cg_thread_createkey ()
CgThreadcg_thread_self ()
static void * PosixThreadProc (void *param)
CgThreadcg_thread_new ()
BOOL cg_thread_delete (CgThread *thread)
BOOL cg_thread_start (CgThread *thread)
BOOL cg_thread_stop (CgThread *thread)
BOOL cg_thread_stop_with_cond (CgThread *thread, CgCond *cond)
BOOL cg_thread_restart (CgThread *thread)
BOOL cg_thread_isrunnable (CgThread *thread)
void cg_thread_setaction (CgThread *thread, CG_THREAD_FUNC func)
void cg_thread_setuserdata (CgThread *thread, void *value)
void * cg_thread_getuserdata (CgThread *thread)

Variables

static pthread_key_t cg_thread_self_ref
static pthread_once_t cg_thread_mykeycreated = PTHREAD_ONCE_INIT

Function Documentation

static void cg_thread_createkey (  )  [static]
BOOL cg_thread_delete ( CgThread thread  ) 

Stop and destroy a thread.

Parameters:
thread Thread to destroy
void* cg_thread_getuserdata ( CgThread thread  ) 

Get the user data pointer

Parameters:
thread Thread from which to get the pointer
BOOL cg_thread_isrunnable ( CgThread thread  ) 

Check if a thread has been started

Parameters:
thread Thread to check
CgThread* cg_thread_new (  ) 

Create a new thread

BOOL cg_thread_restart ( CgThread thread  ) 

Restart a thread. Essentially calls cg_thread_stop() and cg_thread_start()

Parameters:
thread Thread to restart
CgThread* cg_thread_self (  ) 

Get a self reference to thread.

void cg_thread_setaction ( CgThread thread,
CG_THREAD_FUNC  actionFunc 
)

Set the thread's worker function.

Parameters:
thread Thread struct
actionFunc Function pointer to set as the worker function
void cg_thread_setuserdata ( CgThread thread,
void *  data 
)

Set the user data pointer

Parameters:
thread Thread struct
data Pointer to user data
BOOL cg_thread_start ( CgThread thread  ) 

Start a thread (must be created first with ch_thread_new())

Parameters:
thread Thread to start
BOOL cg_thread_stop ( CgThread thread  ) 

Stop a running thread.

Parameters:
thread Thread to stop
BOOL cg_thread_stop_with_cond ( CgThread thread,
CgCond cond 
)

Stop the running thread and signal the given CGCond.

static void* PosixThreadProc ( void *  param  )  [static]
static void sig_handler ( int  sign  )  [static]

Variable Documentation

pthread_once_t cg_thread_mykeycreated = PTHREAD_ONCE_INIT [static]
pthread_key_t cg_thread_self_ref [static]

Generated on Tue Feb 23 23:14:24 2010 for CyberLink for C by  doxygen 1.6.1