CARMA C++
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
Mutex.h
Go to the documentation of this file.
1
#ifndef SZA_UTIL_MUTEX_H
2
#define SZA_UTIL_MUTEX_H
3
11
#include <pthread.h>
12
13
namespace
sza {
14
namespace
util {
15
16
class
Mutex {
17
public
:
18
22
Mutex();
23
27
virtual
~Mutex();
28
29
void
lock();
30
31
void
unlock();
32
36
bool
tryLock();
37
43
bool
isLocked();
44
45
inline
pthread_mutex_t getPthreadVar() {
46
return
mutex_;
47
}
48
49
inline
pthread_mutex_t* getPthreadVarPtr() {
50
return
&mutex_;
51
}
52
53
bool
isItMe();
54
55
private
:
56
57
pthread_mutex_t mutex_;
58
bool
mutexIsReady_;
59
pthread_t who_;
// The identity of the thread who currently has the lock
60
61
};
// End class Mutex
62
63
}
// End namespace util
64
}
// End namespace sza
65
66
67
68
#endif // End #ifndef SZA_UTIL_MUTEX_H
carma
szautil
Mutex.h
Generated by
1.8.5