From Jason Turner

[stopsource.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmptqz7mnv3/{from.md → to.md} +15 -25
tmp/tmptqz7mnv3/{from.md → to.md} RENAMED
@@ -1,42 +1,32 @@
1
  #### General <a id="stopsource.general">[[stopsource.general]]</a>
2
 
3
- The class `stop_source` implements the semantics of making a stop
4
- request. A stop request made on a `stop_source` object is visible to all
5
- associated `stop_source` and `stop_token` [[stoptoken]] objects. Once a
6
- stop request has been made it cannot be withdrawn (a subsequent stop
7
- request has no effect).
8
-
9
  ``` cpp
10
  namespace std {
11
- // no-shared-stop-state indicator
12
- struct nostopstate_t {
13
- explicit nostopstate_t() = default;
14
- };
15
- inline constexpr nostopstate_t nostopstate{};
16
-
17
  class stop_source {
18
  public:
19
  // [stopsource.cons], constructors, copy, and assignment
20
  stop_source();
21
- explicit stop_source(nostopstate_t) noexcept;
22
 
23
- stop_source(const stop_source&) noexcept;
24
- stop_source(stop_source&&) noexcept;
25
- stop_source& operator=(const stop_source&) noexcept;
26
- stop_source& operator=(stop_source&&) noexcept;
27
- ~stop_source();
28
  void swap(stop_source&) noexcept;
29
 
30
- // [stopsource.mem], stop handling
31
- [[nodiscard]] stop_token get_token() const noexcept;
32
- [[nodiscard]] bool stop_possible() const noexcept;
33
- [[nodiscard]] bool stop_requested() const noexcept;
34
  bool request_stop() noexcept;
35
 
36
- [[nodiscard]] friend bool
37
- operator==(const stop_source& lhs, const stop_source& rhs) noexcept;
38
- friend void swap(stop_source& lhs, stop_source& rhs) noexcept;
 
39
  };
40
  }
41
  ```
42
 
 
 
 
 
 
 
 
1
  #### General <a id="stopsource.general">[[stopsource.general]]</a>
2
 
 
 
 
 
 
 
3
  ``` cpp
4
  namespace std {
 
 
 
 
 
 
5
  class stop_source {
6
  public:
7
  // [stopsource.cons], constructors, copy, and assignment
8
  stop_source();
9
+ explicit stop_source(nostopstate_t) noexcept {}
10
 
11
+ // [stopsource.mem], member functions
 
 
 
 
12
  void swap(stop_source&) noexcept;
13
 
14
+ stop_token get_token() const noexcept;
15
+ bool stop_possible() const noexcept;
16
+ bool stop_requested() const noexcept;
 
17
  bool request_stop() noexcept;
18
 
19
+ bool operator==(const stop_source& rhs) noexcept = default;
20
+
21
+ private:
22
+ shared_ptr<unspecified> stop-state; // exposition only
23
  };
24
  }
25
  ```
26
 
27
+ *`stop-state`* refers to the `stop_source`’s associated stop state. A
28
+ `stop_source` object is disengaged when *`stop-state`* is empty.
29
+
30
+ `stop_source` models `stoppable-source`, `copyable`,
31
+ `equality_comparable`, and `swappable`.
32
+