cthread.h
Go to the documentation of this file.
00001 #ifndef __CTHREAD
00002 #define __CTHREAD
00003 
00004 #ifndef EXTERNALPROTO
00005 
00006 #ifdef _WINDOWS
00007 typedef void *CThread_thread_t;
00008 typedef DWORD CThread_func_return_t;
00009 typedef LPVOID CThread_func_arg_t;
00010 typedef CRITICAL_SECTION CThread_mutex_t;
00011 typedef HANDLE EVENT;
00012 typedef DWORD EVENT_TIME;
00013 #else
00014 
00015 typedef struct {
00016         pthread_mutex_t mutex;
00017         pthread_cond_t condition;
00018         int ready_to_go;
00019 } UNIX_EVENT;
00020 
00021 typedef unsigned long EVENT_TIME;
00022 typedef UNIX_EVENT EVENT;
00023 typedef pthread_t CThread_thread_t;
00024 typedef void *CThread_func_return_t;
00025 typedef void *CThread_func_arg_t;
00026 typedef pthread_mutex_t CThread_mutex_t;
00027 #endif
00028 typedef CThread_func_return_t(* CThread_func_t)(CThread_func_arg_t);
00029 
00030 typedef struct {
00031         CThread_thread_t m_ThreadHandle;
00032         unsigned long m_ThreadIdentifier;
00033         unsigned char thread_status;
00034 #ifdef _MACOSX
00035         CFRunLoopRef runLoop;
00036         unsigned char macInitDone;
00037 #endif
00038 } CThread;
00039 
00040 int CThread_create(CThread *cp, CThread_func_t fp, CThread_func_arg_t arg);
00041 int CThread_create_detached(CThread *cp, CThread_func_t fp, CThread_func_arg_t arg);
00042 void CThread_join(CThread *cp);
00043 //void CThread_kill(CThread *cp);
00044 int CThread_is_my_thread(CThread cp);
00045 int CThread_mutex_init(CThread_mutex_t *);
00046 int CThread_mutex_destroy(CThread_mutex_t *mp);
00047 void CThread_mutex_lock(CThread_mutex_t *mp);
00048 void CThread_mutex_unlock(CThread_mutex_t *mp);
00049 
00050 void CThread_set_event(EVENT *ev);
00051 void CThread_reset_event(EVENT *ev);
00052 int CThread_wait_on_event(EVENT *ev, EVENT_TIME time);
00053 void CThread_create_event(EVENT *ev);
00054 int CThread_destroy_event(EVENT *ev);
00055 
00056 int RegisterLocalDevice(CPhidgetHandle phid);
00057 int StartCentralThread();
00058 int JoinCentralThread();
00059 
00060 CThread_func_return_t ReadThreadFunction(CThread_func_arg_t arg);
00061 CThread_func_return_t WriteThreadFunction(CThread_func_arg_t arg);
00062 
00063 #endif
00064 #endif


pedal_monitor
Author(s): Pedro Mendes
autogenerated on Fri Jun 6 2014 18:37:21