aboutsummaryrefslogtreecommitdiff
path: root/include/mutex.h
blob: 5cf2578d793d272ce724653a64d26cb896d46184 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef AK_MUTEX__H
#define AK_MUTEX__H

#include <pthread.h>

namespace newsbeuter {

class mutex {
	public:
		mutex();
		~mutex();
		void lock();
		void unlock();
		bool trylock();

	private:
		pthread_mutex_t mtx;
		pthread_mutexattr_t attr;

	friend class condition;
};

class scope_mutex {
	public:
		scope_mutex(mutex * m);
		~scope_mutex();
	private:
		mutex * mtx;
};

}

#endif