00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef MUTEXPOSIXIMPL_H
00016 #define MUTEXPOSIXIMPL_H
00017
00018 #include "dtoolbase.h"
00019 #include "selectThreadImpl.h"
00020
00021 #ifdef HAVE_POSIX_THREADS
00022
00023 #include <pthread.h>
00024 #include <errno.h>
00025 #include <assert.h>
00026
00027
00028
00029
00030
00031 class EXPCL_DTOOL MutexPosixImpl {
00032 public:
00033 INLINE MutexPosixImpl();
00034 INLINE ~MutexPosixImpl();
00035
00036 INLINE void acquire();
00037 INLINE bool try_acquire();
00038 INLINE void release();
00039
00040 INLINE pthread_mutex_t *get_posix_lock();
00041
00042 private:
00043 pthread_mutex_t _lock;
00044 friend class ConditionVarPosixImpl;
00045 };
00046
00047
00048
00049
00050
00051 class EXPCL_DTOOL ReMutexPosixImpl {
00052 public:
00053 INLINE ReMutexPosixImpl();
00054 INLINE ~ReMutexPosixImpl();
00055
00056 INLINE void acquire();
00057 INLINE bool try_acquire();
00058 INLINE void release();
00059
00060 INLINE pthread_mutex_t *get_posix_lock();
00061
00062 private:
00063 pthread_mutex_t _lock;
00064 };
00065
00066 #include "mutexPosixImpl.I"
00067
00068 #endif // HAVE_POSIX_THREADS
00069
00070 #endif