title: Using boost condition variables
body: <p>I am designing an asynchronous logger class as follows. However, not sure if I am using the  boost condition variable in the right way. Can anyone comment on this? Here the processLogEntry method is a thread function and I am using boost here.</p>
  
  <pre><code>void LogWriter::stopThread()
  {
      mStop = true;
      mCond.notify_one();
      mThread-&gt;join();
  }   
  
  void LogWriter::processLogEntry()
  {
      while(!mStop)
      {
          boost::mutex::scoped_lock lock(mMutex);
          mCond.wait(lock);
          while(!q.empty())
          {
              // process begins
          }
      }
  }
  
  void LogWriter::addLogEntry()
  {
      boost::mutex::scoped_lock lock(mMutex);
      // add it in the queue
      mCond.notify_one();
  }
  </code></pre>