Search code examples
c++eventssynchronizationcross-platformevent-driven-design

Event driven programming - event loops?


I was just wondering, is any implementation of an event loop bound to platform specific code?

By event loop, I'm referring to a simple thread that is checking a queue, working with messages and dispatches appropriately to callbacks.

Because I simply don't see how I'd be able to write one without having to use for examples:

-A semaphore/mutex/event object/Sleep() [windows].

Which of course, the above are not the same for every operating system.

This is for C/C++ by the way.


Solution

  • A few portable, cross platform C++ frameworks have an event queue implemented, for example ACE Reactor framework. Another example is Qt.