Static methods

staticcreate(job:() ‑> Void, ?onAbort:(e:Exception) ‑> Void):Thread

Creates a new thread that will execute the job function, then exit after all events are processed. You can specify a custom exception handler onAbort or else Thread.onAbort will be called.

staticcurrent():Thread

Returns the current thread. If you are calling this function from a native thread that is not the main thread and was not created by Thread.create, this will return you a native thread with a null EvenLoop and isNative set to true. You need to call disposeNative() on such value on thread termination.

staticgetAll():Array<Thread>

Returns a list of all currently running threads. This excludes native threads which were created without Thread.create and have not been registered with a call to Thread.current().

staticinlinemain():Thread

Returns the main thread

staticreadMessage(blocking:Bool):Null<Dynamic>

Variables

read onlyevents:Null<EventLoop>

The events loop of this thread. If this is a native thread, the events will be null.

@:value(true)isBlocking:Bool = true

Tells if we needs to wait for the thread to terminate before we stop the main loop (default:true).

read onlyisNative:Bool

Tells if a thread is a native thread that is not managed by Haxe. See Thread.current for details.

name:Null<String>

Allows to query or change the name of the thread. On some platforms this might allow debugger to identify threads.

Methods

dynamiconAbort(e:Exception):Void

This function is called when an uncaught exception aborted a thread. The error will be printed to stdout but this function can be redefined.