1
Fork 0
hare-playground/cmd/threads/main.ha
2024-06-01 16:46:01 +02:00

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.")!;
};