|
Cyber Garage Portable Runtime (CGPR) for C
|
#include <cgpr/util/cond.h>#include <cgpr/util/list.h>#include <cgpr/util/time.h>#include <pthread.h>#include <signal.h>Data Structures | |
| struct | _CGThread |
| The generic wrapper struct for mUPnP's threads. More... | |
Macros | |
| #define | CG_THREAD_MIN_SLEEP 1000 |
| #define | cg_thread_next(thread) |
| #define | cg_thread_remove(thread) |
| #define | cg_threadlist_clear(threadList) |
| #define | cg_threadlist_size(threadList) |
| #define | cg_threadlist_gets(threadList) |
| #define | cg_threadlist_add(threadList, thread) |
| #define | cg_threadlist_remove(thread) |
Typedefs | |
| typedef struct _CGThread | CGThread |
| The generic wrapper struct for mUPnP's threads. | |
| typedef struct _CGThread | CGThreadList |
| typedef void(* | CG_THREAD_FUNC) (CGThread *) |
Functions | |
| CGThread * | cg_thread_new (void) |
| CGThread * | cg_thread_self (void) |
| 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) |
| void | cg_threadlist_delete (CGThreadList *threadList) |
| bool | cg_threadlist_start (CGThreadList *threadList) |
| bool | cg_threadlist_stop (CGThreadList *threadList) |
| #define CG_THREAD_MIN_SLEEP 1000 |
| #define cg_thread_next | ( | thread | ) |
| #define cg_thread_remove | ( | thread | ) |
| #define cg_threadlist_add | ( | threadList, | |
| 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 | ) |
Clear the contents of a thread list
| threadList | Thread list in question |
| #define cg_threadlist_gets | ( | threadList | ) |
Get the first actual item from a thread list to use as an iterator
| threadList | The thread list in question |
| #define cg_threadlist_remove | ( | thread | ) |
Remove a thread from thread list
| threadList | The thread list in question |
| thread | The thread to be removed |
| #define cg_threadlist_size | ( | 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 mUPnP's threads.
This wrapper has been created to enable 100% code compatibility between different platforms (Linux, Win32 etc..)
| typedef struct _CGThread CGThreadList |
| bool cg_thread_delete | ( | CGThread * | thread | ) |
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 |
| bool cg_thread_isrunnable | ( | CGThread * | thread | ) |
Check if a thread has been started
| thread | Thread to check |
| CGThread * cg_thread_new | ( | void | ) |
Create a new thread
| bool cg_thread_restart | ( | CGThread * | thread | ) |
Restart a thread. Essentially calls cg_thread_stop() and cg_thread_start()
| thread | Thread to restart |
| CGThread * cg_thread_self | ( | void | ) |
Get a self reference to thread.
| 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 |
| bool cg_thread_start | ( | CGThread * | thread | ) |
Start a thread (must be created first with ch_thread_new())
| thread | Thread to start |
| bool cg_thread_stop | ( | CGThread * | thread | ) |
Stop a running thread.
| thread | Thread to stop |
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 | ( | void | ) |
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 |