cpp-pthread
(v1.7.3)
Simple C++ wrapper to pthread functions.
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Modules
Pages
include
pthread
lock_guard.hpp
1
//
2
// lock_guard.hpp
3
// lock_guard
4
//
5
// Created by herbert koelman on 18/03/2016.
6
//
7
//
8
9
#ifndef pthread_lock_guard_H
10
#define pthread_lock_guard_H
11
12
// must be include as first hearder file of each source code file (see IBM's
13
// recommandation for more info p.285 §8.3.1).
14
#include <pthread.h>
15
16
#include "pthread/config.h"
17
#include "pthread/mutex.hpp"
18
19
20
namespace
pthread
{
21
27
//class condition_variable ;
28
37
template
<
class
MutexType>
38
class
lock_guard
{
39
40
friend
class
condition_variable
;
41
42
public
:
50
explicit
lock_guard
(MutexType &m){
//: _mutex(&m) {
51
_mutex = &m ;
52
_mutex->lock();
53
}
54
57
~lock_guard
() {
58
_mutex->unlock();
59
}
60
65
MutexType *
internal_mutex
() {
66
return
_mutex ;
67
}
68
72
void
operator=
(
lock_guard
&) =
delete
;
73
74
private
:
75
MutexType *_mutex;
76
};
77
79
}
// namespace pthread
80
81
#endif
/* pthread_lock_guard_H */
pthread::lock_guard::lock_guard
lock_guard(MutexType &m)
Definition:
lock_guard.hpp:50
pthread::lock_guard::internal_mutex
MutexType * internal_mutex()
Definition:
lock_guard.hpp:65
pthread::lock_guard::~lock_guard
~lock_guard()
Definition:
lock_guard.hpp:57
pthread::lock_guard
Definition:
lock_guard.hpp:38
pthread::lock_guard::operator=
void operator=(lock_guard &)=delete
pthread::condition_variable
Definition:
condition_variable.hpp:56
pthread
Definition:
condition_variable.hpp:22
Generated by
1.8.8