forked from sony/nmos-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshared_mutex.h
32 lines (23 loc) · 911 Bytes
/
shared_mutex.h
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
#ifndef BST_SHARED_MUTEX_H
#define BST_SHARED_MUTEX_H
// Provide bst::shared_mutex, bst::shared_lock etc. using either std:: or boost:: symbols
#if !defined(BST_SHARED_MUTEX_STD) && !defined(BST_SHARED_MUTEX_BOOST)
// To do: Detect whether std::shared_mutex is available using __cplusplus (and compiler/library-specific preprocessor definitions)
// Note: If this isn't defined under the same condition as BST_THREAD_BOOST, adding shared_timed_mutex is problematic
// because its timeout functionality won't be consistent with bst::chrono
#define BST_SHARED_MUTEX_BOOST
#endif
#ifndef BST_SHARED_MUTEX_BOOST
#include <shared_mutex>
namespace bst_shared_mutex = std;
#else
#include <boost/thread/lock_types.hpp>
#include <boost/thread/shared_mutex.hpp>
namespace bst_shared_mutex = boost;
#endif
namespace bst
{
using bst_shared_mutex::shared_mutex;
using bst_shared_mutex::shared_lock;
}
#endif