public MessageBox

Sean Kelly sean at invisibleduck.org
Thu Mar 22 10:58:12 PDT 2012


On Mar 22, 2012, at 8:49 AM, David Nadlinger wrote:

> On Thursday, 22 March 2012 at 00:30:51 UTC, Nathan M. Swan wrote:
>> As I posted a while back, the concept of a variant message queue is wonderful and powerful, and the implementation is great. But the fact that you can't declare "auto mq = new MessageQueue()" is a gaping whole in an otherwise A+ API.
> 
> Nice to hear that I'm not alone with that opinion – I hit the same problem when implementing a request log file writer for Thrift, which runs in a separate thread and communicates with the main thread via a message queue.
> 
> It works great and performed even better than a similar C++ version due to lower lock contention, but the user'd better not try to call receiveOnly!() from »his« thread…

And this is why I've never used receiveOnly.  A simple way to receive a specific message type is great, but throwing if there's anything else in the queue isn't generally what you want, as it assumes complete knowledge of all messages received by the application.  Perhaps what's needed here is something semantically like receiveOnly that doesn't throw?


More information about the Digitalmars-d mailing list