Event-Driven Programming in C++ 1.0
A case study on event-driven programming in C++
Loading...
Searching...
No Matches
main.cpp File Reference

Entry point for the Event Queue demonstration. More...

#include <iostream>
#include <thread>
#include <chrono>
#include "event_queue.hpp"

Functions

int main ()
 

Detailed Description

Entry point for the Event Queue demonstration.

This example demonstrates how to use the EventQueue class to decouple event production from event consumption in a thread-safe manner. Several events are enqueued as lambda functions that print messages to the console. After enqueuing the events, the program processes them in FIFO order.

In real-world applications, events may be enqueued from multiple threads and processed by a dedicated event loop. For simplicity, this demonstration enqueues and processes events in the main thread.

Note
The EventQueue class is thread-safe, so it can safely be used in multi-threaded contexts.

Function Documentation

◆ main()

int main ( )