dolphin-emu/dolphin — pull request #271 by delroth (2014-04-14 00:17:20+00:00)
Title: Threading improvements: add Common::Flag and improve Common::Event

* Create Common::Flag which has the goal of replacing our uses of "volatile bool" in the codebase. Thin wrapper around std::atomic_bool.
* Move Common::Event to a separate header file (Event.h), add tests, reimplement in terms of Common::Flag.

**Rationale**: I'm dreaming of a Dolphin codebase where volatile is banned and the only place atomics are authorized is in well tested Common abstractions. Atomics are way too easy to screw up for everyone (including me), and volatile is stupid ([Volatile Considered Harmful (Linux kernel)](https://www.kernel.org/doc/Documentation/volatile-considered-harmful.txt)). This is a first step towards this: once we have well tested, working abstractions, we can start replacing all the broken volatile stuff with nice code :)

On my hitlist for next patches: a blocking FifoQueue, an atomic counter, and other things I'll find while auditing the codebase. If you have more ideas, ping me on IRC.