Major clean-ups. Migrating to C++11.
[invirt/third/libt4.git] / lock.h
1 #ifndef lock_h
2 #define lock_h
3
4 #include <thread>
5 #include <mutex>
6
7 using std::mutex;
8 using lock = std::unique_lock<std::mutex>;
9
10 class adopt_lock : public lock {
11 public:
12     inline adopt_lock(class mutex &m) : std::unique_lock<std::mutex>(m, std::adopt_lock) {
13     }
14     inline ~adopt_lock() {
15         release();
16     }
17 };
18
19 #endif