From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-06-10 16:34:08
Jody Hagins wrote:
> On Fri, 10 Jun 2005 22:14:41 +0300
> "Peter Dimov" <pdimov_at_[hidden]> wrote:
>> How is a condition variable supposed to behave when used with a null
>> mutex? Is this a legitimate use case?
> I believe it is a valid use case. Consider code for something like a
> popping a message off a message queue. In such a case, the pop()
> member function would block until the message queue was not empty.
> In a single-thread case (i.e., using null_mutex), you would expect
> some kind of exception, because you can not call pop with an empty
> queue in a single threaded case.
Let's take a step back. Why would I use the message queue at all in a single
threaded program? Its whole purpose is to enable inter-thread communication,
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk