Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Intended to be used internally from scheduler threads.
- * Every iteration thread should poll loop and add tasks to scheduler work queues.
- * And only then proceed to execute next task.
- * Users should be able to register new event loops and control their affinity.
- * */
- trait PluggableEventLoop {
- /**
- * Poll events and return tasks to execute.
- * Implementation should poll events from the underlying event loop and
- * return all callbacks which should be executed due to fired events.
- * */
- def poll(): Vector[Runnable]
- /**
- * Shows if the event loop is paused or resumed.
- * Event loop can pause itself on its own due to implementation-specific circumstances
- * (such as pausing of UI event loops due to focus lost).
- * Event loop can resume itself on its own only if it was paused on its own.
- * */
- def isPaused: Boolean
- /**
- * Request the event loop to become paused.
- * Implementation must respect this request.
- * Event loop can pause itself on its own due to implementation-specific circumstances
- * (such as pausing of UI event loops due to focus lost).
- * */
- def pause(): Unit
- /**
- * Request event loop to be resumed.
- * Implementation may ignore this request.
- * Event loop can resume itself on its own only if it was paused on its own.
- * */
- def resume(): Unit
- /**
- * Request to shut down the event loop.
- * Implementation must respect this request.
- * Event loop cannot shut down on its own.
- * */
- def shutdown(): Unit
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement