sttcl  v0.9c
STTCL C++ template state machine framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SttclPosixMutex.h
Go to the documentation of this file.
1 
25 #ifndef STTCLPOSIXMUTEX_H_
26 #define STTCLPOSIXMUTEX_H_
27 
28 #include <pthread.h>
29 #include "../include/SttclTime.h"
30 
31 #if defined(STTCL_POSIX_THREADS) or defined(STTCL_POSIX_IMPL)
32 
33 namespace sttcl
34 {
35 namespace internal
36 {
37 namespace posix_impl
38 {
39 
43 class SttclPosixMutex
44 {
45 public:
46  SttclPosixMutex();
47  ~SttclPosixMutex();
48 
49  void lock();
50  bool try_lock(const TimeDuration<>& timeout);
51  void unlock();
52 
53 private:
54  pthread_mutex_t mutexHandle;
55  bool valid;
56 };
57 
58 }
59 }
60 }
61 #endif
62 #endif /* STTCLPOSIXMUTEX_H_ */