title: boost mutex, condition, scoped_lock , am I using them wrong here?
body: <pre><code>class MyClass
  {
  public:
      void PushMessage(MyMessage m) // Thread 1 calls this
      {
          boost::mutex::scoped_lock lock(mMutex);
          mQueue.push_back(m);
          mCondition.notify_one();
      }
  
      MyMessage PopMessage()
      {
          boost::mutex::scoped_lock lock(mMutex);
          while(mQueue.empty())
              mCondition.wait(lock);
  
          MyMessage message = mQueue.front();
          mQueue.pop_front();
          return message;
      }
  
      void foo() // thread 2 is running this loop, and supposed to get messages
      {
          for(;;)
          {
              MyMessage message = PopMessage();
  
              do_something(message);
          }
      }
  private:
      std::deque&lt;MyMessage&gt; mQueue;
  
      boost::mutex mMutex;
      boost::condition mCondition;
  };
  </code></pre>
  
  <p>When I run the code, <code>PushMessage</code> is called, and <code>foo()</code> is waiting on <code>PopMessage()</code>, but <code>PopMessage</code> never returns. </p>
  
  <p>What does <code>do_something</code> here is not irrelevant I think.</p>
  
  <p>What am I doing wrong here?
  Strangely, the above code worked fine under mac, but I'm having trouble on linux.<br>
  boost version is 1.44.0</p>
  
  <p>Thank you</p>