exhaustMessages

Exhausts the concurrency message mailbox.

This is done between connection attempts to get a fresh start.

void
exhaustMessages
()

Examples

import std.concurrency : receiveTimeout, send, thisTid;
import std.variant : Variant;
import core.time : Duration;

foreach (immutable i; 0..10)
{
    thisTid.send(i);
}

exhaustMessages();

immutable receivedSomething = receiveTimeout(Duration.zero,
    (Variant _) {},
);

assert(!receivedSomething);

Meta