[Issue 14953] std.concurrency: Add function to flush message box

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 27 10:33:45 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14953

--- Comment #7 from Sean Kelly <sean at invisibleduck.org> ---
I think there's already a bugzilla for getting the mailbox size.  It's
definitely come up before, and would be a trivial change.  The way the
MessageBox code works is it has a thread-local queue and then a shared queue. 
When a match isn't found in the thread-local queue the shared queue is moved to
the local queue and the match continues on the new messages.  All of these
operations (empty queue, get size, etc) would operate on the local queue only. 
Touching the shared queue in any way requires acquiring a mutex, which is
generally not what you want for these operations.  In essence, messages in the
shared queue are messages that "arrived" after your operation was executed.

--


More information about the Digitalmars-d-bugs mailing list