Quirrel4.41.0

types.Thread.getstatus

Method on every thread
thread.getstatus(): any

Returns the thread's current state as a string.

Return value

One of:

Notes

A thread has no "dead" state: once its function returns or throws, it goes back to "idle", the same state it started in, and call on it starts the function over. Compare types.Generator.getstatus, whose generator goes to a permanent "dead" instead.

Example

examples/types/thread/getstatus.nut
function body() { suspend(); return "done" }
let t = newthread(body)

println("before the first call =", t.getstatus())
t.call()
println("after call(), parked on suspend =", t.getstatus())
t.wakeup()
// back to idle: a thread has no permanent dead state, unlike a generator
println("after wakeup(), body finished =", t.getstatus())
Output:
before the first call = idle
after call(), parked on suspend = suspended
after wakeup(), body finished = idle

See also

callStarts the thread's function, passing every argument straight through to it.
wakeupResumes a suspended thread, passing one value back to its suspend call.
threadclass index