C++11 thread-safe queue
问题 A project I\'m working on uses multiple threads to do work on a collection of files. Each thread can add files to the list of files to be processed, so I put together (what I thought was) a thread-safe queue. Relevant portions follow: // qMutex is a std::mutex intended to guard the queue // populatedNotifier is a std::condition_variable intended to // notify waiting threads of a new item in the queue void FileQueue::enqueue(std::string&& filename) { std::lock_guard<std::mutex> lock(qMutex); q