Expose a std.concurrency bug by running its unit test with a limited mailbox size.

This commit is contained in:
David Nadlinger 2011-06-09 16:08:01 +02:00
parent 1b894c1ba8
commit 93c41c86a3

View file

@ -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 );
}
}