Addons updated to new doc format
[io.git] / addons / Thread / source / ThreadMutex.h
blob5fdf070df02d58d6e73d2d4bcc1adfbe8adde4f3
1 /*
2 copyright
3 Trevor Fancher, 2006
4 license
5 BSD revised
6 */
9 #ifndef THREADMUTEX_DEFINED
10 #define THREADMUTEX_DEFINED 1
12 #include "Common.h"
13 #ifndef WIN32
14 # include <pthread.h>
15 #endif
17 enum ThreadMutexReturnCode_
19 THREADMUTEX_SUCCESS = 0,
20 THREADMUTEX_FAILURE
22 typedef enum ThreadMutexReturnCode_ ThreadMutexReturnCode;
24 typedef struct ThreadMutex_ ThreadMutex;
25 struct ThreadMutex_
27 #ifdef WIN32
28 HANDLE mutex;
29 #else
30 pthread_mutex_t mutex;
31 #endif
32 int isLocked;
35 // --- constructor
36 ThreadMutex * ThreadMutex_new(void);
38 // --- destructor
39 void ThreadMutex_destroy(ThreadMutex* self);
41 // --- member functions
42 // -- operational functions
43 ThreadMutexReturnCode ThreadMutex_lock(ThreadMutex *self);
44 ThreadMutexReturnCode ThreadMutex_unlock(ThreadMutex *self);
46 #endif