Thread.join
Waits for a thread to exit and reclaims its system resources.
join()
join(timeout)Examples
Test join() function timeout and output the return value.
javascript
function main() {
var t1 = threading.Thread(function() {
Log("Hello thread1")
Sleep(5000)
})
var ret = t1.join(1000)
Log("ret:", ret)
// Output: ret: undefined
ret = t1.join()
Log("ret:", ret)
// Output: ret: {"id":1,"terminated":false,"elapsed":5003252000,"error":null}
}Returns
| Type | Description |
| A |
Arguments
| Name | Type | Required | Description |
timeout | number | No | Timeout for waiting for the thread to end, in milliseconds. When the |
See Also
Remarks
When the join() function times out, it returns undefined.