Packages

builtin
cbindgen
core
core.alloc
core.alloc.arena
core.alloc.atomic
core.alloc.fixed
core.alloc.gc
core.alloc.heap
core.alloc.log
core.alloc.memdebug
core.alloc.pool
core.alloc.ring
core.arg_parse
core.array
core.avl_tree
core.bucket_array
core.conv
core.doc
core.encoding
core.encoding.base64
core.encoding.csv
core.encoding.hex
core.encoding.json
core.encoding.kdl
core.encoding.osad
core.encoding.utf8
core.hash
core.hash.md5
core.hash.sha1
core.hash.sha256
core.heap
core.intrinsics
core.intrinsics.atomics
core.intrinsics.onyx
core.intrinsics.types
core.intrinsics.wasm
core.io
core.io.binary
core.iter
core.js
core.list
core.map
core.math
core.memory
core.misc
core.net
core.os
core.random
core.set
core.slice
core.string
core.sync
core.test
core.thread
core.time
main
runtime
runtime.info
runtime.platform
runtime.vars
simd

package core.thread

Thread
Thread :: struct {
    id: i32;
    alive: bool;
}

Represents a thread. Currently, this is very simple; just the id of the thread and whether or not it is alive.

__exited
__exited :: (id: i32) -> void

Special procedure that is called when a thread exits, or by kill() above.

__initialize
__initialize :: () -> void

Special procedure that should only be called once globally that initialize the map of thread ids to thread data.

join
join :: (t: &Thread) -> void

Waits for a thread to finish before returning. If the thread was not alive in the first place, immediately return.

kill
kill :: (t: &Thread) -> i32

Forcefully kill a thread using runtime.__kill_thread. Does nothing if the thread was not alive.

spawn
spawn :: (t: &Thread, data: &$T, func: (&T) -> void) -> void

Spawns a new thread using the runtime.__spawn_thread function. The primary job of this function is to create the thread-local storage and stack for the new thread, and pass those on. Currently the stack size is not controllable, but that could be remedied.