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

17 lines
306 B
Hare
Raw Normal View History

2024-05-28 10:23:52 +00:00
use types::c;
use fmt;
2024-05-28 10:40:52 +00:00
use thread;
2024-05-28 10:23:52 +00:00
2024-05-28 10:40:52 +00:00
fn thread_start() void = {
2024-05-28 10:23:52 +00:00
fmt::println("hello from another thread")!;
};
export fn main() void = {
fmt::println("starting a thread")!;
2024-05-28 10:40:52 +00:00
let tid = thread::spawn(&thread_start)!;
2024-05-28 10:23:52 +00:00
fmt::println("joining")!;
2024-05-28 10:40:52 +00:00
thread::join(tid)!;
fmt::println("joined. good bye.")!;
2024-05-28 10:23:52 +00:00
};