ETL
0.04.19
Main Page
Related Pages
Classes
Files
File List
File Members
ETL
_mutex_pthreads_simple.h
Go to the documentation of this file.
1
26
/* === S T A R T =========================================================== */
27
28
#ifndef __ETL__MUTEX_PTHREADS_SIMPLE_H_
29
#define __ETL__MUTEX_PTHREADS_SIMPLE_H_
30
31
/* === H E A D E R S ======================================================= */
32
33
#include <pthread.h>
34
35
/* === M A C R O S ========================================================= */
36
37
/* === C L A S S E S & S T R U C T S ======================================= */
38
39
_ETL_BEGIN_NAMESPACE
40
41
class
mutex
42
{
43
pthread_mutex_t
mtx
;
44
public
:
45
mutex
() { pthread_mutex_init(&
mtx
,
NULL
); }
46
~mutex
() { pthread_mutex_destroy(&
mtx
); }
47
void
lock_mutex
() { pthread_mutex_lock(&
mtx
); }
48
void
unlock_mutex
() { pthread_mutex_unlock(&
mtx
); }
49
51
class
lock
52
{
53
mutex
*
_mtx
;
54
public
:
55
lock
(
mutex
&x):
_mtx
(&x) {
_mtx
->
lock_mutex
(); }
56
~lock
() {
_mtx
->
unlock_mutex
(); }
57
};
58
};
59
60
_ETL_END_NAMESPACE
61
62
/* === E N D =============================================================== */
63
64
#endif
Generated on Mon Nov 16 2015 15:32:03 for ETL by
1.8.1.2