text: //
  // system_executor.hpp
  // ~~~~~~~~~~~~~~~~~~~
  //
  // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  //
  // Distributed under the Boost Software License, Version 1.0. (See accompanying
  // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  //
  
  #ifndef ASIO_SYSTEM_EXECUTOR_HPP
  #define ASIO_SYSTEM_EXECUTOR_HPP
  
  #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  # pragma once
  #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  
  #include "asio/detail/config.hpp"
  
  #include "asio/detail/push_options.hpp"
  
  namespace asio {
  
  class system_context;
  
  /// An executor that uses arbitrary threads.
  /**
   * The system executor represents an execution context where functions are
   * permitted to run on arbitrary threads. The post() and defer() functions
   * schedule the function to run on an unspecified system thread pool, and
   * dispatch() invokes the function immediately.
   */
  class system_executor
  {
  public:
    /// Obtain the underlying execution context.
    system_context& context() const ASIO_NOEXCEPT;
  
    /// Inform the executor that it has some outstanding work to do.
    /**
     * For the system executor, this is a no-op.
     */
    void on_work_started() const ASIO_NOEXCEPT
    {
    }
  
    /// Inform the executor that some work is no longer outstanding.
    /**
     * For the system executor, this is a no-op.
     */
    void on_work_finished() const ASIO_NOEXCEPT
    {
    }
  
    /// Request the system executor to invoke the given function object.
    /**
     * This function is used to ask the executor to execute the given function
     * object. The function object will always be executed inside this function.
     *
     * @param f The function object to be called. The executor will make
     * a copy of the handler object as required. The function signature of the
     * function object must be: @code void function(); @endcode
     *
     * @param a An allocator that may be used by the executor to allocate the
     * internal storage needed for function invocation.
     */
    template <typename Function, typename Allocator>
    void dispatch(ASIO_MOVE_ARG(Function) f, const Allocator& a) const;
  
    /// Request the system executor to invoke the given function object.
    /**
     * This function is used to ask the executor to execute the given function
     * object. The function object will never be executed inside this function.
     * Instead, it will be scheduled to run on an unspecified system thread pool.
     *
     * @param f The function object to be called. The executor will make
     * a copy of the handler object as required. The function signature of the
     * function object must be: @code void function(); @endcode
     *
     * @param a An allocator that may be used by the executor to allocate the
     * internal storage needed for function invocation.
     */
    template <typename Function, typename Allocator>
    void post(ASIO_MOVE_ARG(Function) f, const Allocator& a) const;
  
    /// Request the system executor to invoke the given function object.
    /**
     * This function is used to ask the executor to execute the given function
     * object. The function object will never be executed inside this function.
     * Instead, it will be scheduled to run on an unspecified system thread pool.
     *
     * @param f The function object to be called. The executor will make
     * a copy of the handler object as required. The function signature of the
     * function object must be: @code void function(); @endcode
     *
     * @param a An allocator that may be used by the executor to allocate the
     * internal storage needed for function invocation.
     */
    template <typename Function, typename Allocator>
    void defer(ASIO_MOVE_ARG(Function) f, const Allocator& a) const;
  
    /// Compare two executors for equality.
    /**
     * System executors always compare equal.
     */
    friend bool operator==(const system_executor&,
        const system_executor&) ASIO_NOEXCEPT
    {
      return true;
    }
  
    /// Compare two executors for inequality.
    /**
     * System executors always compare equal.
     */
    friend bool operator!=(const system_executor&,
        const system_executor&) ASIO_NOEXCEPT
    {
      return false;
    }
  };
  
  } // namespace asio
  
  #include "asio/detail/pop_options.hpp"
  
  #include "asio/impl/system_executor.hpp"
  
  #endif // ASIO_SYSTEM_EXECUTOR_HPP
  