blob: e8371ea2a74b2a14a17de51b2cf186bb3d8c6b22 [file] [log] [blame]
Marc Slemko66949872006-07-15 01:52:39 +00001#if !defined(_concurrency_mutex_h_)
2#define _concurrency_mutex_h_ 1
3
4namespace facebook { namespace thrift { namespace concurrency {
5
6class Mutex {
7
8 public:
9
10 Mutex();
11
12 virtual ~Mutex() {}
13
14 virtual void lock() const;
15
16 virtual void unlock() const;
17
18 private:
19
20 class impl;
21
22 impl* _impl;
23};
24
25class MutexMonitor {
26 public:
27
28 MutexMonitor(const Mutex& value) : _mutex(value) {
29 _mutex.lock();
30 }
31
32 ~MutexMonitor() {
33 _mutex.unlock();
34 }
35
36 private:
37 const Mutex& _mutex;
38};
39
40
41}}} // facebook::thrift::concurrency
42
43#endif // !defined(_concurrency_mutex_h_)