3.64. kink/thread/THREAD

Provides preemptive threads.

THREAD.spawn starts a new preemptive thread.

Living threads do not prevent the process from exiting, thus they act like Java's daemon threads.

When you spawn a thread, it is automatically detatched from the spawning thread, thus there is no need and/or no way to join the thread. If you want to block until another thread complete its work, use a chan.

3.64.1. THREAD.spawn($thunk)

Spawns a preemptive thread, and runs $thunk in the thread. This fun returns nada.