types.Thread.clone
Method on every
threadclone(): any
Returns the thread itself: a thread has no separate clone identity.
Return value
The same thread clone was called on - clone t == t is always true, whatever state t is in.
Notes
clone is a keyword as well as a method name, so by default t.clone() and t.$clone() do not parse. Use the bracket form, t["clone"](), or the operator form, clone t. Both reach this same method. With #forbid-clone-operator the word is an ordinary identifier and t.$clone() compiles.
Example
function body() { suspend() }
let t = newthread(body)
println("clone t == t =", clone t == t)
println("t[\"clone\"]() == t =", t["clone"]() == t)Output:
clone t == t = true
t["clone"]() == t = trueSee also
weakref | Returns a weak reference to the thread. |
clone | Returns the closure itself: unlike a table, array or class instance, a closure has no separate clone identity. |
| thread | class index |