From Jason Turner

[thread.once.callonce]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpf1t46on4/{from.md → to.md} +10 -16
tmp/tmpf1t46on4/{from.md → to.md} RENAMED
@@ -3,41 +3,35 @@
3
  ``` cpp
4
  template<class Callable, class... Args>
5
  void call_once(once_flag& flag, Callable&& func, Args&&... args);
6
  ```
7
 
8
- *Requires:*
9
-
10
- ``` cpp
11
- INVOKE(std::forward<Callable>(func), std::forward<Args>(args)...)
12
- ```
13
-
14
- (see [[func.require]]) shall be a valid expression.
15
 
16
  *Effects:* An execution of `call_once` that does not call its `func` is
17
  a *passive* execution. An execution of `call_once` that calls its `func`
18
- is an *active* execution. An active execution shall call *INVOKE*(
19
  std::forward\<Callable\>(func), std::forward\<Args\>(args)...). If such
20
  a call to `func` throws an exception the execution is *exceptional*,
21
- otherwise it is *returning*. An exceptional execution shall propagate
22
- the exception to the caller of `call_once`. Among all executions of
23
- `call_once` for any given `once_flag`: at most one shall be a returning
24
- execution; if there is a returning execution, it shall be the last
25
- active execution; and there are passive executions only if there is a
26
- returning execution.
27
 
28
  [*Note 1*: Passive executions allow other threads to reliably observe
29
  the results produced by the earlier returning execution. — *end note*]
30
 
31
  *Synchronization:* For any given `once_flag`: all active executions
32
  occur in a total order; completion of an active execution synchronizes
33
- with ([[intro.multithread]]) the start of the next one in this total
34
  order; and the returning execution synchronizes with the return from all
35
  passive executions.
36
 
37
  *Throws:* `system_error` when an exception is
38
- required ([[thread.req.exception]]), or any exception thrown by `func`.
39
 
40
  [*Example 1*:
41
 
42
  ``` cpp
43
  // global flag, regular function
 
3
  ``` cpp
4
  template<class Callable, class... Args>
5
  void call_once(once_flag& flag, Callable&& func, Args&&... args);
6
  ```
7
 
8
+ *Mandates:* `is_invocable_v<Callable, Args...>` is `true`.
 
 
 
 
 
 
9
 
10
  *Effects:* An execution of `call_once` that does not call its `func` is
11
  a *passive* execution. An execution of `call_once` that calls its `func`
12
+ is an *active* execution. An active execution calls *INVOKE*(
13
  std::forward\<Callable\>(func), std::forward\<Args\>(args)...). If such
14
  a call to `func` throws an exception the execution is *exceptional*,
15
+ otherwise it is *returning*. An exceptional execution propagates the
16
+ exception to the caller of `call_once`. Among all executions of
17
+ `call_once` for any given `once_flag`: at most one is a returning
18
+ execution; if there is a returning execution, it is the last active
19
+ execution; and there are passive executions only if there is a returning
20
+ execution.
21
 
22
  [*Note 1*: Passive executions allow other threads to reliably observe
23
  the results produced by the earlier returning execution. — *end note*]
24
 
25
  *Synchronization:* For any given `once_flag`: all active executions
26
  occur in a total order; completion of an active execution synchronizes
27
+ with [[intro.multithread]] the start of the next one in this total
28
  order; and the returning execution synchronizes with the return from all
29
  passive executions.
30
 
31
  *Throws:* `system_error` when an exception is
32
+ required [[thread.req.exception]], or any exception thrown by `func`.
33
 
34
  [*Example 1*:
35
 
36
  ``` cpp
37
  // global flag, regular function