I am writing a movie player using boost. I use a condition_variable to control a mutex in one thread that waits for packets of video to be ready for decoding, while another thread feeds those packets. My problem is that the decode thread may end up doing a lot of work when playing backwards and it is not ready to wait on the condition variable when the message comes from the other thread and so it hangs (or so I think). This is my wait loop. I apologize for the use of macros. #define SCOPED_LOCK(mutex) Mutex::scoped_lock lk_##mutex(mutex) #define CONDITION_WAIT( cond, mutex ) cond.wait( lk_##mutex ); void aviImage::wait_image() { mrv::PacketQueue::Mutex& vpm = _video_packets.mutex(); SCOPED_LOCK( vpm ); for(;;) { if ( stopped() || ! _video_packets.empty() ) break; CONDITION_WAIT( _video_packets.cond(), vpm ); } return; } When it returns it tries to decode one or more frames of video taken from _video_packets. The condition variable is notified whenever the program calls push_back() to add a packet. That is: class PacketQueue { .... inline void push_back( AVPacket& pkt ) { Mutex::scoped_lock lk( _mutex ); // assert( pkt.dts != MRV_NOPTS_VALUE ); if ( av_dup_packet(&pkt) < 0 ) { std::cerr << "Could not duplicate packet - not added" << std::endl; return; } _packets.push_back( pkt ); _bytes += pkt.size; _cond.notify_one(); } }; Can somebody suggest an alternative to this scheme? -- Gonzalo Garramuño