Module jls.lang.Thread
Represents a thread of execution.
Class Thread
Thread:new ([fn]) | Creates a new Thread. |
thread:start ([...]) | Starts this Thread. |
thread:ended () | Returns a promise that resolves once this thread is terminated. |
thread:isAlive () | Returns true if this thread is alive. |
thread:join () | Blocks until this thread terminates. |
Class Thread
A Thread class.
- Thread:new ([fn])
-
Creates a new Thread.
Parameters:
- fn function the function to execute in this thread. The function will receive the arguments passed in the start call. The function may return a single value. Start arguments and return values shall be primitive type: string, number, boolean or nil (optional)
- thread:start ([...])
-
Starts this Thread.
The arguments will be passed to the thread function.
If the thread is already running then nothing is done.
Parameters:
- ... The thread function arguments. (optional)
Returns:
-
jls.lang.Thread
this thread.
- thread:ended ()
-
Returns a promise that resolves once this thread is terminated.
Returns:
-
jls.lang.Promise
a promise that resolves once this thread is terminated.
- thread:isAlive ()
-
Returns true if this thread is alive.
Returns:
-
boolean
true if this thread is alive.
- thread:join ()
- Blocks until this thread terminates.