$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: David A. Greene (greened_at_[hidden])
Date: 2006-02-09 20:20:04
David Greene wrote:
>        void push(int val) {
> 	 LOG_NOLCK("push(): about to lock");
> 	 {
> 	    lock_type lock(mutex);
> 	    LOG_NOLCK("push(): locked");
> 	    queue.push(val);
> 	
> 	    lock_type full_lock(full_mutex);
> 	    LOG_NOLCK("push(): about to unlock");
> 	 }
> 	 full_condition.notify_all();
>       };
Whoops!  This is a race condition.  Because the full_lock is
released, there's no guaratee the consumer is waiting on the
condition and the signal may be lost.  When I moved the lock
after the inner brace, everything started working.
                              -Dave