reactorace

ACE Reactor - non-blocking events loop without thread?


Is there a built-in way in ACE to listen to a Reactor events in a non-blocking way? Or do I have to create a thread manually?

Also is it safe to create the reactor on one thread and start its event loop on another thread?

Thanks!


Solution

  • If you want to use a single thread you can call the event loop with a timer to limit the amount of time spent waiting for events.

    You could also run the event loop in a separate thread whether you create the reactor in the main thread or a spawned thread.

    Note there are many ways to integrate event types into the reactor so often you can leave control completely in the reactor event loop.