From: Brendan Hansen Date: Tue, 19 Oct 2021 02:42:01 +0000 (-0500) Subject: ensuring threading is working X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=4d8561af9afd84815dfa9f19a16b3589a7494f73;p=onyx-particle-sim.git ensuring threading is working --- 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