From: Alexander Terekhov (yg-boost-users_at_[hidden])
Date: 2003-05-22 14:10:13


Mark Sizer wrote:
>
> I have a message queue class that has the following API:
>
> post( msg );
> msg get();
[...]
> Am I missing something or is this "expected" behavior?

Yes, it seems that you're missing something.

http://www.boost.org/libs/thread/example/condition.cpp

But note that you don't really need to own the mutex ["predictable
scheduling" aside] while signaling. Also, certain optimizations are
possible for single-consumer and/or single-producer vs. the classic
bounded buffer with multiple consumers/producers. Yeah, and you'll
NEVER beat Ada's "proxy model"-monitors ("protected objects"). ;-)

regards,
alexander.