From Jason Turner

[thread.lock.guard]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpr9io7awb/{from.md → to.md} +8 -12
tmp/tmpr9io7awb/{from.md → to.md} RENAMED
@@ -15,41 +15,37 @@ namespace std {
15
  lock_guard& operator=(const lock_guard&) = delete;
16
 
17
  private:
18
  mutex_type& pm; // exposition only
19
  };
20
-
21
- template<class Mutex> lock_guard(lock_guard<Mutex>) -> lock_guard<Mutex>;
22
  }
23
  ```
24
 
25
  An object of type `lock_guard` controls the ownership of a lockable
26
  object within a scope. A `lock_guard` object maintains ownership of a
27
- lockable object throughout the `lock_guard` object’s lifetime (
28
- [[basic.life]]). The behavior of a program is undefined if the lockable
29
  object referenced by `pm` does not exist for the entire lifetime of the
30
  `lock_guard` object. The supplied `Mutex` type shall meet the
31
- `BasicLockable` requirements ([[thread.req.lockable.basic]]).
32
 
33
  ``` cpp
34
  explicit lock_guard(mutex_type& m);
35
  ```
36
 
37
- *Requires:* If `mutex_type` is not a recursive mutex, the calling thread
38
- does not own the mutex `m`.
39
 
40
- *Effects:* As if by `m.lock()`.
41
-
42
- *Postconditions:* `&pm == &m`
43
 
44
  ``` cpp
45
  lock_guard(mutex_type& m, adopt_lock_t);
46
  ```
47
 
48
- *Requires:* The calling thread owns the mutex `m`.
49
 
50
- *Postconditions:* `&pm == &m`
51
 
52
  *Throws:* Nothing.
53
 
54
  ``` cpp
55
  ~lock_guard();
 
15
  lock_guard& operator=(const lock_guard&) = delete;
16
 
17
  private:
18
  mutex_type& pm; // exposition only
19
  };
 
 
20
  }
21
  ```
22
 
23
  An object of type `lock_guard` controls the ownership of a lockable
24
  object within a scope. A `lock_guard` object maintains ownership of a
25
+ lockable object throughout the `lock_guard` object’s lifetime
26
+ [[basic.life]]. The behavior of a program is undefined if the lockable
27
  object referenced by `pm` does not exist for the entire lifetime of the
28
  `lock_guard` object. The supplied `Mutex` type shall meet the
29
+ *Cpp17BasicLockable* requirements [[thread.req.lockable.basic]].
30
 
31
  ``` cpp
32
  explicit lock_guard(mutex_type& m);
33
  ```
34
 
35
+ *Preconditions:* If `mutex_type` is not a recursive mutex, the calling
36
+ thread does not own the mutex `m`.
37
 
38
+ *Effects:* Initializes `pm` with `m`. Calls `m.lock()`.
 
 
39
 
40
  ``` cpp
41
  lock_guard(mutex_type& m, adopt_lock_t);
42
  ```
43
 
44
+ *Preconditions:* The calling thread owns the mutex `m`.
45
 
46
+ *Effects:* Initializes `pm` with `m`.
47
 
48
  *Throws:* Nothing.
49
 
50
  ``` cpp
51
  ~lock_guard();