]> git.stg.codes - stg.git/blob - projects/traffcounter/lock.h
4a89c2977d6453d4097b01a68f2ffd2635122d24
[stg.git] / projects / traffcounter / lock.h
1 #ifndef __SCOPED_LOCK_H__
2 #define __SCOPED_LOCK_H__
3
4 #include <pthread.h>
5
6 class SCOPED_LOCK
7 {
8 public:
9     SCOPED_LOCK(pthread_mutex_t & mtx);
10     ~SCOPED_LOCK();
11 private:
12     pthread_mutex_t & mutex;
13
14     SCOPED_LOCK(const SCOPED_LOCK & lock) : mutex(lock.mutex) {};
15 };
16
17 #endif