Called when the thread starts, before the job is executed.

Static methods

staticaddCallbacks(callbacks:ThreadCallbacks):IThreadCallbackHandle

Registers callbacks to be called for every thread, both already-running and future ones. Returns a handle that can be used to unregister the callbacks.

Unlike callbacks passed to Thread.create, closing the returned handle prevents the callbacks from being called even for threads that are already running.

staticaddCurrentCallbacks(callbacks:CurrentThreadCallbacks):IThreadCallbackHandle

Registers callbacks to be called for the current thread.

staticcreate(?name:String, job:() ‑> Void, ?callbacks:ThreadCallbacks):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>

Deprecated: "Use haxe.EventLoop.getThreadLoop(thread) instead"

finalid:Int

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