CAF 0.17.6
|
Low-level backend for IO multiplexing. More...
#include <multiplexer.hpp>
Classes | |
class | runnable |
Simple wrapper for runnables. More... | |
class | supervisor |
Makes sure the multipler does not exit its event loop until the destructor of supervisor has been called. More... | |
Public Types | |
using | supervisor_ptr = std::unique_ptr< supervisor > |
Public Member Functions | |
multiplexer (actor_system *sys) | |
virtual scribe_ptr | new_scribe (native_socket fd)=0 |
Creates a new scribe from a native socket handle. | |
virtual expected< scribe_ptr > | new_tcp_scribe (const std::string &host, uint16_t port)=0 |
Tries to connect to host on given port and returns a scribe instance on success. | |
virtual doorman_ptr | new_doorman (native_socket fd)=0 |
Creates a new doorman from a native socket handle. | |
virtual expected< doorman_ptr > | new_tcp_doorman (uint16_t port, const char *in=nullptr, bool reuse_addr=false)=0 |
Tries to create an unbound TCP doorman bound to port , optionally accepting only connections from IP address in . | |
virtual datagram_servant_ptr | new_datagram_servant (native_socket fd)=0 |
Creates a new datagram_servant from a native socket handle. | |
virtual datagram_servant_ptr | new_datagram_servant_for_endpoint (native_socket fd, const ip_endpoint &ep)=0 |
virtual expected< datagram_servant_ptr > | new_remote_udp_endpoint (const std::string &host, uint16_t port)=0 |
Create a new datagram_servant to contact a remote endpoint host and port . | |
virtual expected< datagram_servant_ptr > | new_local_udp_endpoint (uint16_t port, const char *in=nullptr, bool reuse_addr=false)=0 |
Create a new datagram_servant that receives datagrams on the local port , optionally only accepting connections from IP address in . | |
virtual supervisor_ptr | make_supervisor ()=0 |
Creates a supervisor to keep the event loop running. | |
virtual bool | try_run_once ()=0 |
Exectutes all pending events without blocking. | |
virtual void | run_once ()=0 |
Runs at least one event and blocks if needed. | |
virtual void | run ()=0 |
Runs events until all connection are closed. | |
template<class F > | |
void | dispatch (F fun) |
Invokes fun in the multiplexer's event loop, calling fun() immediately when called from inside the event loop. | |
template<class F > | |
void | post (F fun) |
Invokes fun in the multiplexer's event loop, forcing execution to be delayed when called from inside the event loop. | |
virtual multiplexer_backend * | pimpl () |
Retrieves a pointer to the implementation or nullptr if CAF was compiled using the default backend. | |
const std::thread::id & | thread_id () const |
void | thread_id (std::thread::id tid) |
![]() | |
execution_unit (actor_system *sys) | |
execution_unit (execution_unit &&)=default | |
execution_unit & | operator= (execution_unit &&)=default |
execution_unit (const execution_unit &)=default | |
execution_unit & | operator= (const execution_unit &)=default |
virtual void | exec_later (resumable *ptr)=0 |
Enqueues ptr to the job list of the execution unit. | |
actor_system & | system () const |
Returns the enclosing actor system. | |
proxy_registry * | proxy_registry_ptr () |
Returns a pointer to the proxy factory currently associated to this unit. | |
void | proxy_registry_ptr (proxy_registry *ptr) |
Associated a new proxy factory to this unit. | |
Static Public Member Functions | |
static std::unique_ptr< multiplexer > | make (actor_system &sys) |
Creates an instance using the networking backend compiled with CAF. | |
Protected Attributes | |
std::thread::id | tid_ |
Identifies the thread this multiplexer is running in. | |
![]() | |
actor_system * | system_ = nullptr |
proxy_registry * | proxies_ = nullptr |
Low-level backend for IO multiplexing.
Invokes fun
in the multiplexer's event loop, calling fun()
immediately when called from inside the event loop.
@threadsafe
|
pure virtual |
Creates a new datagram_servant
from a native socket handle.
@threadsafe
|
pure virtual |
Creates a new doorman from a native socket handle.
@threadsafe
|
pure virtual |
Create a new datagram_servant
that receives datagrams on the local port
, optionally only accepting connections from IP address in
.
|
pure virtual |
Create a new datagram_servant
to contact a remote endpoint host
and port
.
|
pure virtual |
Creates a new scribe
from a native socket handle.
@threadsafe
|
pure virtual |
Tries to create an unbound TCP doorman bound to port
, optionally accepting only connections from IP address in
.
|
pure virtual |
Tries to connect to host
on given port
and returns a scribe
instance on success.
@threadsafe
Invokes fun
in the multiplexer's event loop, forcing execution to be delayed when called from inside the event loop.
@threadsafe
Exectutes all pending events without blocking.
true
if at least one event was called, false
otherwise.
|
protected |
Identifies the thread this multiplexer is running in.
Must be set by the subclass.