Skip to content

foldcat/oasync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

oasync

M:N multithreading for Odin. The end goal is to implement virtual threads that automatically and quickly parallelize tasks across several os threads.

usage

Note that this library is in PRE ALPHA STATE. It lacks essential features and may randomly cause segmented fault.

However, please test out the library and report issues you have encountered.

package oasynctest

import oa "../oasync"
import "core:fmt"

child :: proc() {
    fmt.println("hi from child task")
}

core :: proc() {
    fmt.println("test")
    // spawn a procedure in a virtual thread
    oa.go(child)
}

main :: proc() {
    coord := oa.Coordinator{}
    cfg := oa.Config {
        // amount of threads to use
        worker_count    = 4,
        // use the main thread as a worker (does not contribute towards worker_count)
        use_main_thread = true,
    }

    // fire off the async runtime
    oa.init(&coord, cfg, oa.make_task(core))
}

About

M:N lightweight threading for odin

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages