Thread.terminate
Forcibly terminates a thread and releases the hardware resources occupied when the thread was created.
terminate()Examples
Forcibly terminate the execution of a thread. After forcibly terminating the thread, the content output by that thread will no longer be displayed in the logs.
javascript
function main() {
var t1 = threading.Thread(function() {
for (var i = 0; i < 10; i++) {
Log("thread1 i:", i)
Sleep(1000)
}
})
Sleep(3000)
t1.terminate()
Log("after t1.terminate()")
while (true) {
LogStatus(_D())
Sleep(1000)
}
}See Also
Remarks
A thread forcibly terminated with the terminate() function can still be joined; join() returns promptly with terminated set to true.