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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 25 13:51:45 PDT 2015


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

Sean Kelly <sean at invisibleduck.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sean at invisibleduck.org

--- Comment #1 from Sean Kelly <sean at invisibleduck.org> ---
I think this can be handled a few different ways.  The most straightforward
would be to do:

    m_localBox.clear();
    m_localPty.clear();

Which would wipe everything.  It might be better (albeit slower) to let the
user supply a filter though.  Basically:

    discard(int,int,int);

Removes all messages that would map to:

    receive((int, int, int) {});

And:

    discard(Variant);

Would effectively clear the mailbox.  Perhaps this second version could special
case to the efficient:

    m_localBox.clear();
    m_localPty.clear();

mentioned above.

--


More information about the Digitalmars-d-bugs mailing list