setMaxMailboxSize
Byron Heads
wyverex.cypher at gmail.com
Thu Jun 17 14:31:10 PDT 2010
is setMaxMailboxSize not implemented yet or is it bugged?
This test program does not work right:
import core.sys.posix.unistd;
import std.stdio,
std.concurrency,
std.random;
void main()
{
auto a = spawn( &bar, thisTid );
setMaxMailboxSize( a, 1, OnCrowding.block );
writeln( "Mail box set" );
auto b = spawn( &foo, thisTid, a );
}
void foo( Tid p, Tid t )
{
t.send( 1 );
t.send( 2 );
t.send( 3 );
writeln( "FOO is done!" );
}
void bar( Tid p )
{
receive( (int x ) { writeln( "BAR got ", x );} );
sleep( 1 );
receive( (int x ) { writeln( "BAR got ", x );} );
sleep( 1 );
receive( (int x ) { writeln( "BAR got ", x );} );
sleep( 1 );
}
It prints:
Mail box set
BAR got 1
FOO is done!
BAR got 2
BAR got 3
foo should be getting blocked.
-B
More information about the Digitalmars-d-learn
mailing list