1
Fork 0
hare-playground/backend/cmd/threads/main.ha

18 lines
377 B
Hare

use types::c;
use fmt;
use thread;
fn thread_start(data: nullable *opaque) void = {
let arg = data: *u32;
fmt::printfln("hello from another thread. you sent: {}", *arg)!;
};
export fn main() void = {
fmt::println("starting a thread")!;
let tid = thread::spawn(&thread_start, &42)!;
fmt::println("joining")!;
thread::join(tid)!;
fmt::println("joined. good bye.")!;
};