13 Asynchronous model [async]

13.19 Class system_context [async.system.context]

Class system_context implements the execution context associated with system_executor objects.

namespace std {
namespace experimental {
namespace net {
inline namespace v1 {

  class system_context : public execution_context
  {
  public:
    // types:

    using executor_type = system_executor;

    // construct / copy / destroy:

    system_context() = delete;
    system_context(const system_context&) = delete;
    system_context& operator=(const system_context&) = delete;
    ~system_context();

    // system_context operations:

    executor_type get_executor() noexcept;

    void stop();
    bool stopped() const noexcept;
    void join();
  };

} // inline namespace v1
} // namespace net
} // namespace experimental
} // namespace std

The class system_context satisfies the ExecutionContext ([async.reqmts.executioncontext]) type requirements.

The system_context member functions get_executor, stop, and stopped, and the system_executor copy constructors, member functions and comparison operators, do not introduce data races as a result of concurrent calls to those functions from different threads of execution.

~system_context();

Effects: Performs stop() followed by join().

executor_type get_executor() noexcept;

Returns: system_executor().

void stop();

Effects: Signals all system threads to exit as soon as possible. If a system thread is currently executing a function object, the thread will exit only after completion of that function object. Returns without waiting for the system threads to complete.

Postconditions: stopped() == true.

bool stopped() const noexcept;

Returns: true if the system_context has been stopped by a prior call to stop.

void join();

Effects: Blocks the calling thread (C++ 2014 [defns.block]) until all system threads have completed.

Synchronization: The completion of each system thread synchronizes with (C++ 2014 [intro.multithread]) the corresponding successful join() return.