Beta Release 0.1.5

This release brings additions to Onyx's platform layer, allowing for missing things like futexes and TTY control.


A fast-userspace mutex (or futex) is mechanism that allows any memory address to be used as a resource that can be waited on and woken up. Most users will not have to use futexes in their own programs, but they significantly benefit the standard synchronization library. They allow for mutexes, semaphores and condition variables to not rely on spin-looping to wait.

Before futexes, the following kind of program would have had an expensive spin-loop that would have negated the efficiency trying to be gained. Now, both threads barely use any CPU time.

use core {*}

counter: sync.Semaphore;

main :: () {
    sync.semaphore_init(&counter, 0);

    // Spawn a thread that infinitely waits for a semaphore to be signaled.
    t: thread.Thread;
    thread.spawn(&t, cast(&i32, null), _ => {
        while true {
            println("Got a signal!");

    // Every second, signal the semaphore.
    while true {

Futexes are available in the onyx and js platform layers. The wasi platform layer currently does not support futexes of any kind. However, a new WASI standard, WASIX, does support futexes.

Full Changelog

- Added ability to control the size of the tag type for tagged unions.
    - `union #tag_type u8`
- Infrastructure to have custom sub-commands.
    - Any `*.wasm` file in `$ONYX_PATH/tools` is available to run with `onyx `
- `__futex_wait` and `__futex_wake` to platform layer.
    - This allows for non-busy-waiting on mutexes and semaphores.
    - Currently implemented for Onyx and JS platforms; WASI is impossible, but WASIX will come soon.
- `--skip-native` flag to `onyx pkg sync` to skip compiling native libraries.
- Ability to tag methods on structures.
- `tty_get` and `tty_set` functions in `core.os`
    - Allows for controlling raw and echoed input
    - Currently only for `onyx` runtime and on Linux only.
- `-Dno_entrypoint` for programs that do not have a `main` function.

- `Wait_Notify_Available` global in `runtime` package.
    - This is no longer needed as futexes are preferred instead of wait/notify.


- Fixed bug in `json.encode` that caused arrays of structures to not be outputted correctly.
- Fixed bug in `onyx pkg` that caused `onyx pkg new` to not work as intended.
© 2020-2024 Brendan Hansen