COROIO: NNet::TLoop< TPoller > Class Template Reference
COROIO
 
Loading...
Searching...
No Matches
NNet::TLoop< TPoller > Class Template Reference

A generic event loop wrapper that uses TSelect as its poller. More...

#include <loop.hpp>

Public Member Functions

void Loop ()
 Runs the main loop until Stop() is called.
 
void Stop ()
 Stops the loop.
 
void Step ()
 Performs a single iteration of polling and waking up ready handles.
 
TPoller & Poller ()
 Provides access to the underlying poller instance.
 

Detailed Description

template<typename TPoller>
class NNet::TLoop< TPoller >

A generic event loop wrapper that uses TSelect as its poller.

The event loop continuously calls Step() until explicitly stopped via Stop().

Example Usage

#include <iostream>
int main() {
// Instantiate the event loop with TSelect
// Run a single iteration of polling and wakeup
loop.Step();
// Stop the loop
loop.Stop();
// Alternatively, to run continuously:
// loop.Loop(); // Will keep calling Step() until Stop() is called
return 0;
}
A generic event loop wrapper that uses TSelect as its poller.
Definition loop.hpp:34
void Stop()
Stops the loop.
Definition loop.hpp:47
void Step()
Performs a single iteration of polling and waking up ready handles.
Definition loop.hpp:53
Template Parameters
TPollerA type that provides polling and wakeup mechanisms (TSelect here).

The documentation for this class was generated from the following file: