A simple Haxe class for easily running threads and calling functions on the primary thread. from https://github.com/underscorediscovery/

Usage: - call Runner.init() from your primary thread - call Runner.tick() periodically to service callbacks (i.e inside your main loop) - use Runner.thread(function() { ... }) to make a thread - use Runner.runInMainThread(function() { ... }) to run code on the main thread - use runInMainThreadBlocking to run code on the main thread and wait for the return value

Static methods

staticinlinecurrentIsMainThread():Bool

Returns true if current running thread is main thread

Returns:

Bool

staticinlineisEmulatingBackgroundWithMain():Bool

Returns true if running in background is emulated on this platform by running background code in main thread instead of using background thread.

staticrunInMain(_fn:() ‑> Void):Void

Call a function on the primary thread without waiting or blocking. If you want return values see runInMainBlocking

staticrunInBackground(fn:() ‑> Void):Void

Create a background thread using the given function, or just run (deferred) the function if threads are not supported