Corrected a deadlock with wait and pulse.
The buffer is now thread safe for multiple consumers.