mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Expose a std.concurrency bug by running its unit test with a limited mailbox size.
This commit is contained in:
parent
1b894c1ba8
commit
93c41c86a3
1 changed files with 13 additions and 4 deletions
|
@ -1358,15 +1358,24 @@ version( unittest )
|
||||||
prioritySend( tid, "done" );
|
prioritySend( tid, "done" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void runTest( Tid tid )
|
||||||
unittest
|
|
||||||
{
|
{
|
||||||
auto tid = spawn( &testfn, thisTid );
|
|
||||||
|
|
||||||
send( tid, 42, 86 );
|
send( tid, 42, 86 );
|
||||||
send( tid, tuple(42, 86) );
|
send( tid, tuple(42, 86) );
|
||||||
send( tid, "hello", "there" );
|
send( tid, "hello", "there" );
|
||||||
send( tid, "the quick brown fox" );
|
send( tid, "the quick brown fox" );
|
||||||
receive( (string val) { assert(val == "done"); } );
|
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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue