Events are the Funky way to handle multiple input/output streams in a parallel way.
The event system is based on the concept of an event "loop". The event "loop" is part of the application program.
Before entering the event loop, the application program must create an input-output object and register all input-output streams that should be handled by the event loop.
To create an input-output object, simply clone the object std_types::io.
The event loop then waits for an event to occur. When an event occurs, the event loop calls the event handler function associated with the event.
The event handler function can then process the event and return to the event loop.
The event loop continues to wait for the next event.
Possible events can be registered or unregistered at any time.
To register an event call
std::start_reading_from - for reading from a stream
std::start_catching_signals - for catching signals like SIGINT
std::start_injecting_window_change_events - for catching window change events
To unregister an event call
std::stop_reading_from - to stop reading from a stream
std::stop_catching_signals - to stop catching signals
std::stop_injecting_window_change_events - to stop injecting window change events
In the event loop call
std::get_events - to get one or more events
Actual input operations are performed by std::get_events. Write operations are initiated by the application program and performed by std::get_events.
Input-Output |
Input-Output Task Manager |
std::PROCESS_JOINED | used to tag "process joined" events |
std::READ | used to tag "read" events |
std::READ_ERROR | used to tag "read error" events |
std::SIGNAL | used to tag "signal" events |
std::WRITE_COMPLETED | used to tag "write completed" events |
std::WRITE_ERROR | used to tag "write error" events |
std::WRITE_PENDING | used to tag "write pending" events |
std::cancel_write | cancels a write operation |
std::get_events | gets one or more events |
std::join_process | joins a process |
std::start_catching_signals | starts catching signals |
std::start_injecting_window_change_events | starts receiving window change events |
std::start_reading_from | registers a read request for a file descriptor |
std::stop_catching_signals | stops catching signals |
std::stop_injecting_window_change_events | stops receiving window change events |
std::stop_reading_from | unregisters a read request for a file descriptor |
std_types::event | the prototype for all events |
std_types::io | the prototype for all input-output objects |
std_types::io/std::cancel_write | cancels a write operation |
std_types::io/std::get_events | gets one or more events |
std_types::io/std::is_empty | checks if the input-output object contains any event registrations |
std_types::io/std::is_not_empty | checks if the input-output object contains any event registrations |
std_types::io/std::join_process | joins a process |
std_types::io/std::start_catching_signals | starts catching signals |
std_types::io/std::start_injecting_window_change_events | starts receiving window change events |
std_types::io/std::start_reading_from | registers a read reqest for a file descriptor |
std_types::io/std::stop_catching_signals | stops catching signals |
std_types::io/std::stop_injecting_window_change_events | stops receiving window change events |
std_types::io/std::stop_reading_from | unregisters a read request for a file descriptor |
std_types::io/std::write | writes data to a stream |