Library: Net
Package: Reactor
Header: Poco/Net/SocketReactor.h
Description
RAII wrapper that starts a SocketReactor in a thread and automatically stops and joins on destruction.
Usage:
ScopedSocketReactor reactor; reactor->addEventHandler(socket, observer); // ... reactor runs in background thread ... // automatically stopped and joined when reactor goes out of scope
Member Summary
Member Functions: operator *, operator->, reactor, thread
Constructors
ScopedSocketReactor
Creates and starts the reactor.
ScopedSocketReactor
explicit ScopedSocketReactor(
const SocketReactor::Params & params
);
Creates and starts the reactor with the given parameters.
Destructor
~ScopedSocketReactor
Stops the reactor and joins the thread.
Member Functions
operator *
SocketReactor & operator * ();
Returns a reference to the reactor.
operator *
const SocketReactor & operator * () const;
Returns a const reference to the reactor.
operator->
SocketReactor * operator-> ();
Returns a pointer to the reactor.
operator->
const SocketReactor * operator-> () const;
Returns a const pointer to the reactor.
reactor
SocketReactor & reactor();
Returns a reference to the reactor.
thread
Poco::Thread & thread();
Returns a reference to the thread.