Skip to content

The Combined Event Loop

bmeck edited this page Sep 8, 2010 · 10 revisions

There is a problem when two event loops collide, SFML demonstrates this problem.

The Situation:

sf::Window only queues events with sf::Window::GetEvent, this means events will stack up while waiting.

The Problem:

By Node.js conventions, we should emit these events to listeners. However, we cannot do this easily from C++ without some concerns.

The Solutions:

###Add events async to the event loop using v8's locker mechanism using a separate thread.

  • Lockers can take a while to get to.
  • Synchronization logic

###At the end of any event loop, check for events in our sf::Window pool.

  • Can slow down the whole node.js event loop.
  • Goes through JS to C++ bridge back and forth like crazy
Clone this wiki locally