tmp/tmpt_nvs59o/{from.md → to.md}
RENAMED
|
@@ -1,24 +1,23 @@
|
|
| 1 |
#### Timed mutex types <a id="thread.timedmutex.requirements">[[thread.timedmutex.requirements]]</a>
|
| 2 |
|
| 3 |
The *timed mutex types* are the standard library types
|
| 4 |
-
`std::timed_mutex`
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
`
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
The timed mutex types shall meet the `TimedLockable` requirements (
|
| 11 |
[[thread.req.lockable.timed]]).
|
| 12 |
|
| 13 |
The expression `m.try_lock_for(rel_time)` shall be well-formed and have
|
| 14 |
the following semantics:
|
| 15 |
|
| 16 |
-
If
|
| 17 |
-
|
| 18 |
-
native tick `period`. If `m` is of type `std::timed_mutex`, the calling
|
| 19 |
-
thread does not own the mutex.
|
| 20 |
|
| 21 |
*Effects:* The function attempts to obtain ownership of the mutex within
|
| 22 |
the relative timeout ([[thread.req.timing]]) specified by `rel_time`.
|
| 23 |
If the time specified by `rel_time` is less than or equal to
|
| 24 |
`rel_time.zero()`, the function attempts to obtain ownership without
|
|
@@ -34,17 +33,17 @@ implementations are expected to make a strong effort to do so.
|
|
| 34 |
|
| 35 |
*Synchronization:* If `try_lock_for()` returns `true`, prior `unlock()`
|
| 36 |
operations on the same object *synchronize
|
| 37 |
with* ([[intro.multithread]]) this operation.
|
| 38 |
|
| 39 |
-
*Throws:*
|
| 40 |
|
| 41 |
The expression `m.try_lock_until(abs_time)` shall be well-formed and
|
| 42 |
have the following semantics:
|
| 43 |
|
| 44 |
-
*Requires:* If `m` is of type `std::timed_mutex`
|
| 45 |
-
does not own the mutex.
|
| 46 |
|
| 47 |
*Effects:* The function attempts to obtain ownership of the mutex. If
|
| 48 |
`abs_time` has already passed, the function attempts to obtain ownership
|
| 49 |
without blocking (as if by calling `try_lock()`). The function shall
|
| 50 |
return before the absolute timeout ([[thread.req.timing]]) specified by
|
|
@@ -59,11 +58,11 @@ strong effort to do so.
|
|
| 59 |
|
| 60 |
*Synchronization:* If `try_lock_until()` returns `true`, prior
|
| 61 |
`unlock()` operations on the same object *synchronize
|
| 62 |
with* ([[intro.multithread]]) this operation.
|
| 63 |
|
| 64 |
-
*Throws:*
|
| 65 |
|
| 66 |
##### Class `timed_mutex` <a id="thread.timedmutex.class">[[thread.timedmutex.class]]</a>
|
| 67 |
|
| 68 |
``` cpp
|
| 69 |
namespace std {
|
|
@@ -73,11 +72,11 @@ namespace std {
|
|
| 73 |
~timed_mutex();
|
| 74 |
|
| 75 |
timed_mutex(const timed_mutex&) = delete;
|
| 76 |
timed_mutex& operator=(const timed_mutex&) = delete;
|
| 77 |
|
| 78 |
-
void lock();
|
| 79 |
bool try_lock();
|
| 80 |
template <class Rep, class Period>
|
| 81 |
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
| 82 |
template <class Clock, class Duration>
|
| 83 |
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
|
@@ -119,11 +118,11 @@ namespace std {
|
|
| 119 |
~recursive_timed_mutex();
|
| 120 |
|
| 121 |
recursive_timed_mutex(const recursive_timed_mutex&) = delete;
|
| 122 |
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
|
| 123 |
|
| 124 |
-
void lock();
|
| 125 |
bool try_lock() noexcept;
|
| 126 |
template <class Rep, class Period>
|
| 127 |
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
| 128 |
template <class Clock, class Duration>
|
| 129 |
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
|
|
|
| 1 |
#### Timed mutex types <a id="thread.timedmutex.requirements">[[thread.timedmutex.requirements]]</a>
|
| 2 |
|
| 3 |
The *timed mutex types* are the standard library types
|
| 4 |
+
`std::timed_mutex`, `std::recursive_timed_mutex`, and
|
| 5 |
+
`std::shared_timed_mutex`. They shall meet the requirements set out
|
| 6 |
+
below. In this description, `m` denotes an object of a mutex type,
|
| 7 |
+
`rel_time` denotes an object of an instantiation of `duration` (
|
| 8 |
+
[[time.duration]]), and `abs_time` denotes an object of an instantiation
|
| 9 |
+
of `time_point` ([[time.point]]).
|
| 10 |
|
| 11 |
The timed mutex types shall meet the `TimedLockable` requirements (
|
| 12 |
[[thread.req.lockable.timed]]).
|
| 13 |
|
| 14 |
The expression `m.try_lock_for(rel_time)` shall be well-formed and have
|
| 15 |
the following semantics:
|
| 16 |
|
| 17 |
+
If `m` is of type `std::timed_mutex` or `std::shared_timed_mutex`, the
|
| 18 |
+
calling thread does not own the mutex.
|
|
|
|
|
|
|
| 19 |
|
| 20 |
*Effects:* The function attempts to obtain ownership of the mutex within
|
| 21 |
the relative timeout ([[thread.req.timing]]) specified by `rel_time`.
|
| 22 |
If the time specified by `rel_time` is less than or equal to
|
| 23 |
`rel_time.zero()`, the function attempts to obtain ownership without
|
|
|
|
| 33 |
|
| 34 |
*Synchronization:* If `try_lock_for()` returns `true`, prior `unlock()`
|
| 35 |
operations on the same object *synchronize
|
| 36 |
with* ([[intro.multithread]]) this operation.
|
| 37 |
|
| 38 |
+
*Throws:* Timeout-related exceptions ([[thread.req.timing]]).
|
| 39 |
|
| 40 |
The expression `m.try_lock_until(abs_time)` shall be well-formed and
|
| 41 |
have the following semantics:
|
| 42 |
|
| 43 |
+
*Requires:* If `m` is of type `std::timed_mutex` or
|
| 44 |
+
`std::shared_timed_mutex`, the calling thread does not own the mutex.
|
| 45 |
|
| 46 |
*Effects:* The function attempts to obtain ownership of the mutex. If
|
| 47 |
`abs_time` has already passed, the function attempts to obtain ownership
|
| 48 |
without blocking (as if by calling `try_lock()`). The function shall
|
| 49 |
return before the absolute timeout ([[thread.req.timing]]) specified by
|
|
|
|
| 58 |
|
| 59 |
*Synchronization:* If `try_lock_until()` returns `true`, prior
|
| 60 |
`unlock()` operations on the same object *synchronize
|
| 61 |
with* ([[intro.multithread]]) this operation.
|
| 62 |
|
| 63 |
+
*Throws:* Timeout-related exceptions ([[thread.req.timing]]).
|
| 64 |
|
| 65 |
##### Class `timed_mutex` <a id="thread.timedmutex.class">[[thread.timedmutex.class]]</a>
|
| 66 |
|
| 67 |
``` cpp
|
| 68 |
namespace std {
|
|
|
|
| 72 |
~timed_mutex();
|
| 73 |
|
| 74 |
timed_mutex(const timed_mutex&) = delete;
|
| 75 |
timed_mutex& operator=(const timed_mutex&) = delete;
|
| 76 |
|
| 77 |
+
void lock(); // blocking
|
| 78 |
bool try_lock();
|
| 79 |
template <class Rep, class Period>
|
| 80 |
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
| 81 |
template <class Clock, class Duration>
|
| 82 |
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
|
|
|
| 118 |
~recursive_timed_mutex();
|
| 119 |
|
| 120 |
recursive_timed_mutex(const recursive_timed_mutex&) = delete;
|
| 121 |
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
|
| 122 |
|
| 123 |
+
void lock(); // blocking
|
| 124 |
bool try_lock() noexcept;
|
| 125 |
template <class Rep, class Period>
|
| 126 |
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
| 127 |
template <class Clock, class Duration>
|
| 128 |
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|