23 #ifndef __LSCP_THREAD_H 24 #define __LSCP_THREAD_H 30 #if (defined(_WIN32) || defined(__WIN32__)) 44 #if defined(__cplusplus) 67 #define lscp_mutex_init(m) { (m) = CreateMutex(NULL, 0, NULL); } 68 #define lscp_mutex_destroy(m) if (m) { CloseHandle(m); } 69 #define lscp_mutex_lock(m) WaitForSingleObject((m), INFINITE) 70 #define lscp_mutex_unlock(m) ReleaseMutex(m) 73 #define lscp_mutex_init(m) pthread_mutex_init(&(m), NULL) 74 #define lscp_mutex_destroy(m) pthread_mutex_destroy(&(m)) 75 #define lscp_mutex_lock(m) pthread_mutex_lock(&(m)) 76 #define lscp_mutex_unlock(m) pthread_mutex_unlock(&(m)) 84 #define lscp_cond_init(c) { (c) = CreateEvent(NULL, FALSE, FALSE, NULL); } 85 #define lscp_cond_destroy(c) if (c) { CloseHandle(c); } 86 #define lscp_cond_wait(c, m) { lscp_mutex_unlock(m); WaitForSingleObject((c), INFINITE); lscp_mutex_lock(m); } 87 #define lscp_cond_signal(c) SetEvent(c) 90 #define lscp_cond_init(c) pthread_cond_init(&(c), NULL) 91 #define lscp_cond_destroy(c) pthread_cond_destroy(&(c)) 92 #define lscp_cond_wait(c, m) pthread_cond_wait(&(c), &(m)) 93 #define lscp_cond_signal(c) pthread_cond_signal(&(c)) 111 #define lscp_thread_exit() ExitThread(0) 113 #define lscp_thread_exit() pthread_exit(NULL) 116 #if defined(__cplusplus) 120 #endif // __LSCP_THREAD_H
lscp_status_t lscp_thread_cancel(lscp_thread_t *pThread)
Definition: thread.c:135
enum _lscp_status_t lscp_status_t
void(* lscp_thread_proc_t)(void *pvData)
Definition: thread.h:101
pthread_mutex_t lscp_mutex_t
Definition: thread.h:72
lscp_thread_proc_t pfnProc
Definition: thread.c:36
lscp_status_t lscp_thread_destroy(lscp_thread_t *pThread)
Definition: thread.c:160
_lscp_status_t
Definition: thread.h:51
lscp_status_t lscp_thread_join(lscp_thread_t *pThread)
Definition: thread.c:110
pthread_cond_t lscp_cond_t
Definition: thread.h:89
int iDetach
Definition: thread.c:38
void * pvData
Definition: thread.c:37
lscp_thread_t * lscp_thread_create(lscp_thread_proc_t pfnProc, void *pvData, int iDetach)
Definition: thread.c:63