#include <cybergarage/typedef.h>
#include <cybergarage/util/clist.h>
#include <cybergarage/util/ccond.h>
#include <pthread.h>
#include <signal.h>
Data Structures | |
struct | _CgThread |
The generic wrapper struct for CyberLinkC's threads. More... | |
Defines | |
#define | cg_thread_next(thread) (CgThread *)cg_list_next((CgList *)thread) |
#define | cg_thread_remove(thread) cg_list_remove((CgList *)thread) |
#define | cg_threadlist_clear(threadList) cg_list_clear((CgList *)threadList, (CG_LIST_DESTRUCTORFUNC)cg_thread_delete) |
#define | cg_threadlist_size(threadList) cg_list_size((CgList *)threadList) |
#define | cg_threadlist_gets(threadList) (CgThread *)cg_list_next((CgList *)threadList) |
#define | cg_threadlist_add(threadList, thread) cg_list_add((CgList *)threadList, (CgList *)thread) |
Typedefs | |
typedef _CgThread | CgThread |
The generic wrapper struct for CyberLinkC's threads. | |
typedef _CgThread | CgThreadList |
The generic wrapper struct for CyberLinkC's threads. | |
typedef void(*) | CG_THREAD_FUNC (CgThread *) |
Functions | |
CgThread * | cg_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 actionFunc) |
void | cg_thread_setuserdata (CgThread *thread, void *data) |
void * | cg_thread_getuserdata (CgThread *thread) |
CgThreadList * | cg_threadlist_new () |
void | cg_threadlist_delete (CgThreadList *threadList) |
BOOL | cg_threadlist_start (CgThreadList *threadList) |
BOOL | cg_threadlist_stop (CgThreadList *threadList) |
#define cg_thread_remove | ( | thread | ) | cg_list_remove((CgList *)thread) |
#define cg_threadlist_add | ( | threadList, | |||
thread | ) | cg_list_add((CgList *)threadList, (CgList *)thread) |
Add a thread into a thread list
threadList | The thread list in question | |
thread | The thread to add to the list |
#define cg_threadlist_clear | ( | threadList | ) | cg_list_clear((CgList *)threadList, (CG_LIST_DESTRUCTORFUNC)cg_thread_delete) |
Clear the contents of a thread list
threadList | Thread list in question |
Get the first actual item from a thread list to use as an iterator
threadList | The thread list in question |
#define cg_threadlist_size | ( | threadList | ) | cg_list_size((CgList *)threadList) |
Get the size of a thread list
threadList | The thread list in question |
typedef void(*) CG_THREAD_FUNC(CgThread *) |
Prototype for the threads' worker functions
The generic wrapper struct for CyberLinkC's threads.
This wrapper has been created to enable 100% code compatibility between different platforms (Linux, Win32 etc..)
typedef struct _CgThread CgThreadList |
The generic wrapper struct for CyberLinkC's threads.
This wrapper has been created to enable 100% code compatibility between different platforms (Linux, Win32 etc..)
Stop and destroy a thread.
thread | Thread to destroy |
void* cg_thread_getuserdata | ( | CgThread * | thread | ) |
Get the user data pointer
thread | Thread from which to get the pointer |
Check if a thread has been started
thread | Thread to check |
CgThread* cg_thread_new | ( | ) |
Create a new thread
Restart a thread. Essentially calls cg_thread_stop() and cg_thread_start()
thread | Thread to restart |
void cg_thread_setaction | ( | CgThread * | thread, | |
CG_THREAD_FUNC | actionFunc | |||
) |
Set the thread's worker function.
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
thread | Thread struct | |
data | Pointer to user data |
Start a thread (must be created first with ch_thread_new())
thread | Thread to start |
Stop the running thread and signal the given CGCond.
void cg_threadlist_delete | ( | CgThreadList * | threadList | ) |
Destroy a thread list
threadList | The thread list in question |
CgThreadList* cg_threadlist_new | ( | ) |
Create a new thread list
BOOL cg_threadlist_start | ( | CgThreadList * | threadList | ) |
Start all threads in the thread list
threadList | The thread list in question |
BOOL cg_threadlist_stop | ( | CgThreadList * | threadList | ) |
Stop all threads in the thread list
threadList | The thread list in question |