Handles async events for all threads
Static variables
Static methods
Constructor
Variables
Methods
add(callb:() ‑> Void, priority:Int = 0):Event
Add a callback to be run at each loop of the event loop.
addAsync(priority:Int = 0):Event
Similar to add but will return the Event before it's started.
This is useful if you wish to hold a reference of another thread Event loop
before it runs.
addTimer(callb:() ‑> Void, delay:Float, priority:Int = 0):Event
Add a callback to be run every delay seconds until stopped
deliver():Void
Deliver after a promise(). This will throw an exception if more deliver() calls has been made than corresponding promise() calls.
dispose():Void
This should be called after you are finished with a custom event loop. It is already automatically called for threads loops.
hasEvents(blocking:Bool = true):Bool
Tells if the event loop has remaining events. If blocking is set to true, only check if it has remaining blocking events.
loop():Void
Runs until all the blocking events have been stopped. If this is called on the main thread, also wait for all blocking threads to finish.
loopOnce(threadCheck:Bool = true):Void
Perform an update of pending events.
By default, an event loop from a thread can only be triggered from this thread.
You can set threadCheck to false in the rare cases you might want otherwise.