CXXGraph
0.4.0
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
include
Utility
ThreadSafe.hpp
1
/***********************************************************/
2
/*** ______ ____ ______ _ ***/
3
/*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
4
/*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
5
/*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
6
/*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
7
/*** |_| ***/
8
/***********************************************************/
9
/*** Header-Only C++ Library for Graph ***/
10
/*** Representation and Algorithms ***/
11
/***********************************************************/
12
/*** Author: ZigRazor ***/
13
/*** E-Mail: zigrazor@gmail.com ***/
14
/***********************************************************/
15
/*** Collaboration: ----------- ***/
16
/***********************************************************/
17
/*** License: MPL v2.0 ***/
18
/***********************************************************/
19
20
#ifndef __CXXGRAPH_THREADSAFE_H__
21
#define __CXXGRAPH_THREADSAFE_H__
22
23
#pragma once
24
25
#include <mutex>
26
27
namespace
CXXGRAPH
28
{
29
class
ThreadSafe
30
{
31
public
:
32
void
getLock()
const
;
33
void
releaseLock()
const
;
34
35
protected
:
36
mutable
std::mutex mutex;
37
};
38
//inline because the implementation of non-template function in header file
39
inline
void
ThreadSafe::getLock()
const
40
{
41
mutex.lock();
42
}
43
//inline because the implementation of non-template function in header file
44
inline
void
ThreadSafe::releaseLock()
const
45
{
46
mutex.unlock();
47
}
48
}
49
50
#endif
// __CXXGRAPH_THREADSAFE_H__
CXXGRAPH::ThreadSafe
Definition:
ThreadSafe.hpp:30
Generated by
1.9.1