#include <evo/ioasync_base.h>
Base class for Async I/O.
|
static struct timeval * | get_timeout_ptr (struct timeval &out, ulong ms) |
| Get timeval struct pointer from timeout in milliseconds. More...
|
|
◆ AsyncBase()
◆ ~AsyncBase()
Destructor.
- This detaches from parent, if applicable
◆ check_client_active()
virtual bool check_client_active |
( |
| ) |
|
|
inlineprotectedvirtual |
Called during client event-loop to check whether any client requests are active (client only).
- This is used to determine if all client requests were handled
- Only AsyncClient should override this, AsyncServer should leave the default
- Returns
- Whether any client requests are active, true if a request is in progress (waiting for response or write is pending)
◆ get_timeout_ptr()
static struct timeval* get_timeout_ptr |
( |
struct timeval & |
out, |
|
|
ulong |
ms |
|
) |
| |
|
inlinestaticprotected |
Get timeval struct pointer from timeout in milliseconds.
- Parameters
-
out | Struct to store timeout |
ms | Time in milliseconds to use |
- Returns
- Pointer to
out
, or NULL if ms
is 0
◆ init()
Initialize event-loop.
- Ignored if already initialized
◆ init_attach()
Initialize and attach to a parent event-loop.
- Ignored if already initialized
- Parameters
-
◆ run_eventloop()
Run event loop and process all events and repeat until shutdown.
- Returns
- Whether successful, false on internal error
◆ run_eventloop_once()
bool run_eventloop_once |
( |
| ) |
|
|
inlineprotected |
Run event loop with one pass and process all events.
- This waits until some events are active then processes all active events and returns
- Returns
- Whether successful, false on internal error
◆ runlocal()
Run the event-loop locally in current thread until all pending requests are handled (client only).
- This blocks while client requests are pending
- This returns false immediately if this does not own an event-loop (i.e. was attached to a parent) – only the top parent can run an event-loop
- Returns
- Whether successful, false if attached to another AsyncBase or on internal error
◆ set_logger()
Set logger to use.
- If set, a logger shows low-level details and error information from the framework
- The logger pointer must remain valid as long as it's referenced here
- Parameters
-
newlogger | Pointer to logger to set, NULL for none (no logging) |
◆ set_timeout()
void set_timeout |
( |
ulong |
read_timeout_ms = 0 , |
|
|
ulong |
write_timeout_ms = 0 |
|
) |
| |
|
inline |
Set read/write timeouts to use.
- Parameters
-
read_timeout_ms | Socket read timeout in milliseconds, 0 for none (never timeout) |
write_timeout_ms | Socket write timeout in milliseconds, 0 for none (never timeout) |
◆ set_timer()
bool set_timer |
( |
OnTimer & |
on_timer, |
|
|
ulong |
msec |
|
) |
| |
|
inline |
Activate timer so it expires after given time elapses.
- Parameters
-
on_timer | Timer to use |
msec | Expiration time in milliseconds |
- Returns
- Whether successful, false on internal error
◆ child_base_
◆ evloop_
Event loop pointer, either owned by this or a parent.
◆ local_
Whether event-loop is local (same thread), false if separate thread.
◆ logger
◆ parent_base_
Pointer to parent in AsyncBase chain, NULL if this is the main parent (and owns evloop_ pointer)
◆ read_timeout_ms_
Socket read timeout in milliseconds, 0 for none (never timeout)
◆ write_timeout_ms_
Socket write timeout in milliseconds, 0 for none (never timeout)
The documentation for this class was generated from the following file: