Used Atomic functions to update variables shared between the CPU and GPU threads.
Changed the variables from bool to u32 to match the atomic functions.