Thread.join-return
This JSON is the data structure returned by the join() member function of the Thread object, used to store information related to concurrent threads in JavaScript language strategies. The Thread object refers to a thread object created via threading.Thread().
Attributes
| Name | Type | Description |
id | number | Thread ID. |
terminated | bool | Whether the thread was forcibly terminated. |
elapsed | number | Thread execution time (nanoseconds). |
error | string | Error message when the thread fails (throws an exception); |
ret | any | Return value of the thread function, which can be of any type; |
See Also
Remarks
join(timeout) returns undefined (not null) when the thread has not finished within the timeout; you can call join() again later to keep waiting. The following code tests the timeout mechanism of the join() function of the Thread object and prints the return value of the join() function.
javascript
function testFunc() {
for (var i = 0; i < 5; i++) {
Log(i)
Sleep(300)
}
}
function main() {
var t1 = threading.Thread(testFunc)
Log(t1.join(1000)) // undefined
Log(t1.join()) // {"id":1,"terminated":false,"elapsed":1506864000,"error":null}
}