Experimental Thread API.
Note that the debugger does not properly support threads at the moment.
Static methods
staticcreate(callb:() ‑> Void):Thread
Available on hl, neko, cpp, java
Creates a new thread that will execute the f function, then exit.
staticcreate(f:() ‑> Void):Thread
Available on macro
Creates a new thread that will execute the f function, then exit.
staticdelay(f:Float):Void
Available on macro
Suspends the execution of the calling thread for f seconds. The other program
threads continue to run during this time.
staticjoin(thread:Thread):Void
Available on macro
Suspends the execution of the calling thread until the thread thread has
terminated.
staticreadMessage(block:Bool):Dynamic
Available on hl, neko, cpp, java
Reads a message from the thread queue. If block is true, the function
blocks until a message is available. If block is false, the function
returns null if no message is available.
staticreadMessage<T>(block:Bool):T
Available on macro
Reads a message from the thread queue. If block is true, the function
blocks until a message is available. If block is false, the function
returns null if no message is available.
Constructor
Methods
id():Int
Available on macro
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
Available on macro
Terminate prematurely the thread whose handle is given. This functionality is available only with bytecode-level threads.
sendMessage(msg:Dynamic):Void
Available on hl, neko, cpp, java
Send a message to the thread queue. This message can be read by using readMessage.
sendMessage<T>(msg:T):Void
Available on macro
Send a message to the thread queue. This message can be read by using readMessage.