Static methods

staticdelay(f:Float):Void

Suspends the execution of the calling thread for f seconds. The other program threads continue to run during this time.

staticexit():Void

Terminate prematurely the currently executing thread.

staticjoin(thread:NativeThread):Void

Suspends the execution of the calling thread until the thread thread has terminated.

staticreadMessage<T>(block:Bool):T

staticself():NativeThread

Return the thread currently executing.

staticyield():Void

Re-schedule the calling thread without suspending it. This function can be used to give scheduling hints, telling the scheduler that now is a good time to switch to other threads.

Constructor

new(f:() ‑> Void)

Creates a new thread that executes function f.

Exceptions caused while executing f are printed to stderr and are not propagated to the parent thread.

Methods

id():Int

Return the identifier of the given thread. A thread identifier is an integer that identifies uniquely the thread. It can be used to build data structures indexed by threads.

kill():Int

Terminate prematurely the thread whose handle is given. This functionality is available only with bytecode-level threads.

sendMessage<T>(msg:T):Void