From 93c41c86a345655fd33c7ab851e78d2816915c75 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Thu, 9 Jun 2011 16:08:01 +0200 Subject: [PATCH] Expose a std.concurrency bug by running its unit test with a limited mailbox size. --- std/concurrency.d | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/std/concurrency.d b/std/concurrency.d index 599207d13..655324f24 100644 --- a/std/concurrency.d +++ b/std/concurrency.d @@ -1358,15 +1358,24 @@ version( unittest ) prioritySend( tid, "done" ); } - - unittest + void runTest( Tid tid ) { - auto tid = spawn( &testfn, thisTid ); - send( tid, 42, 86 ); send( tid, tuple(42, 86) ); send( tid, "hello", "there" ); send( tid, "the quick brown fox" ); receive( (string val) { assert(val == "done"); } ); } + + + unittest + { + auto tid = spawn( &testfn, thisTid ); + runTest( tid ); + + // Run the test again with a limited mailbox size. + tid = spawn( &testfn, thisTid ); + setMaxMailboxSize( tid, 2, OnCrowding.block ); + runTest( tid ); + } }