From 4d8561af9afd84815dfa9f19a16b3589a7494f73 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Mon, 18 Oct 2021 21:42:01 -0500 Subject: [PATCH] ensuring threading is working --- src/sim.onyx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/sim.onyx b/src/sim.onyx index e7b3b2b..1bf9456 100644 --- a/src/sim.onyx +++ b/src/sim.onyx @@ -15,6 +15,18 @@ package main main :: (args) => { ouit.init("main_canvas", handle_event, update, draw); ouit.start(); + + t: thread.Thread; + thread.spawn(^t, null, (_) => { + i := 0; + while true { + use package core.intrinsics.atomics + i += 1; + + __atomic_wait(cast(^i32) null, 0, 1000000000); + printf("Count: {}\n", i); + } + }); } x: f32 = 0; @@ -51,7 +63,7 @@ draw :: () { gl.clearColor(.1, .1, .1, 1); gl.clear(gl.COLOR_BUFFER_BIT); - gfx.rect(.{ x, y }, .{ 50, 50 }, .{ 1, 1, 1 }); + gfx.rect(.{ x, y }, .{ 50, 50 }, .{ 1, 0, 0 }); gfx.flush(); } \ No newline at end of file -- 2.25.1