Merge pull request #271 from delroth/threading-stuff Threading improvements: add Common::Flag and improve Common::Event