tmp/tmp749su8f3/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##### Class `shared_timed_mutex` <a id="thread.sharedtimedmutex.class">[[thread.sharedtimedmutex.class]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
class shared_timed_mutex {
|
| 6 |
+
public:
|
| 7 |
+
shared_timed_mutex();
|
| 8 |
+
~shared_timed_mutex();
|
| 9 |
+
|
| 10 |
+
shared_timed_mutex(const shared_timed_mutex&) = delete;
|
| 11 |
+
shared_timed_mutex& operator=(const shared_timed_mutex&) = delete;
|
| 12 |
+
|
| 13 |
+
// Exclusive ownership
|
| 14 |
+
void lock(); // blocking
|
| 15 |
+
bool try_lock();
|
| 16 |
+
template <class Rep, class Period>
|
| 17 |
+
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
| 18 |
+
template <class Clock, class Duration>
|
| 19 |
+
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
| 20 |
+
void unlock();
|
| 21 |
+
|
| 22 |
+
// Shared ownership
|
| 23 |
+
void lock_shared(); // blocking
|
| 24 |
+
bool try_lock_shared();
|
| 25 |
+
template <class Rep, class Period>
|
| 26 |
+
bool
|
| 27 |
+
try_lock_shared_for(const chrono::duration<Rep, Period>& rel_time);
|
| 28 |
+
template <class Clock, class Duration>
|
| 29 |
+
bool
|
| 30 |
+
try_lock_shared_until(const chrono::time_point<Clock, Duration>& abs_time);
|
| 31 |
+
void unlock_shared();
|
| 32 |
+
};
|
| 33 |
+
}
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
The class `shared_timed_mutex` provides a non-recursive mutex with
|
| 37 |
+
shared ownership semantics.
|
| 38 |
+
|
| 39 |
+
The class `shared_timed_mutex` shall satisfy all of the
|
| 40 |
+
`SharedTimedMutex` requirements (
|
| 41 |
+
[[thread.sharedtimedmutex.requirements]]). It shall be a standard-layout
|
| 42 |
+
class (Clause [[class]]).
|
| 43 |
+
|
| 44 |
+
The behavior of a program is undefined if:
|
| 45 |
+
|
| 46 |
+
- it destroys a `shared_timed_mutex` object owned by any thread,
|
| 47 |
+
- a thread attempts to recursively gain any ownership of a
|
| 48 |
+
`shared_timed_mutex`, or
|
| 49 |
+
- a thread terminates while possessing any ownership of a
|
| 50 |
+
`shared_timed_mutex`.
|
| 51 |
+
|