Simplified the run flags by switching to atomic<bool> instead of using atomic_flag which is usually
for implementing spinlocks.