21#ifndef IO_EXECUTOR_HPP 
   22#define IO_EXECUTOR_HPP 
   25#include "io/error.hpp" 
   28#include <exec/async_scope.hpp> 
   29#include <stdexec/execution.hpp> 
   34template <Multiplexer Mux> 
class basic_triggers;
 
 
   46template <Multiplexer Mux> 
class executor : 
public Mux {
 
   61  using async_scope = exec::async_scope;
 
   76  template <SocketLike Socket>
 
   77  static auto push(std::shared_ptr<Socket> socket) -> 
decltype(
auto)
 
   82      throw_system_error(IO_ERROR_MESSAGE(
"fcntl failed."));
 
 
   91  template <SocketLike Socket>
 
   92  static auto push(Socket &&handle) -> 
decltype(
auto)
 
   94    return push(std::make_shared<Socket>(std::forward<Socket>(handle)));
 
 
  101  template <
typename... Args>
 
  102  static auto emplace(Args &&...args) -> std::shared_ptr<socket_handle>
 
 
  112  template <
typename... Args> 
auto set(Args &&...args) -> 
decltype(
auto)
 
  114    return scope_.nest(Mux::set(std::forward<Args>(args)...));
 
 
  120  [[nodiscard]] 
auto on_empty() -> 
decltype(
auto) { 
return scope_.on_empty(); }
 
  128  constexpr auto wait_for(
int interval = -1) -> 
decltype(
auto)
 
  130    return Mux::wait_for(
typename Mux::interval_type{interval});
 
  136  constexpr auto wait() -> 
decltype(
auto) { 
return wait_for(); }
 
 
A class that provides a high-level interface for an executor.
Definition triggers.hpp:38
An executor that uses a multiplexer to wait for events.
Definition executor.hpp:46
static auto emplace(Args &&...args) -> std::shared_ptr< socket_handle >
Emplaces a socket handle in the collection.
Definition executor.hpp:102
static auto push(std::shared_ptr< Socket > socket) -> decltype(auto)
Configures the socket to be non-blocking.
Definition executor.hpp:77
auto on_empty() -> decltype(auto)
Sends a notice when the executor is empty.
Definition executor.hpp:120
auto set(Args &&...args) -> decltype(auto)
Sets a completion handler for an event.
Definition executor.hpp:112
static auto push(Socket &&handle) -> decltype(auto)
Pushes a socket handle to the collection.
Definition executor.hpp:92
A thread-safe, move-only RAII wrapper for a native socket handle.
Definition socket_handle.hpp:42
This file defines concepts for the execution components.
This file defines generic customization points.
auto fcntl(auto &&socket, int cmd, auto &&...args) -> decltype(auto)
Performs a file control operation on a socket.
Definition customization.hpp:134
Provides high-level interfaces for executors and completion triggers.
Definition executor.hpp:33
Cross-platform, thread-safe RAII socket wrapper.