--- Coro/t/16_signal.t 2008/11/19 00:06:55 1.1 +++ Coro/t/16_signal.t 2008/11/19 02:07:48 1.2 @@ -1,5 +1,5 @@ $|=1; -print "1..7\n"; +print "1..10\n"; no warnings; use Coro; @@ -10,7 +10,7 @@ $as1 = async { my $g = $sig->wait; - print "ok 2\n"; + print "ok 3\n"; }; $as2 = async { @@ -18,39 +18,42 @@ print "ok 4\n"; }; - cede; - - $sig->send; + cede; # put 1, 2 in wait q $as3 = async { my $g = $sig->wait; - print "ok 5\n"; + print "ok 2\n"; }; - $sig->send; - $as4 = async { my $g = $sig->wait; print "ok 6\n"; }; - $sig->send; + $as5 = async { + my $g = $sig->wait; + print "ok 9\n"; + }; + + $sig->send; # ready 1 + $sig->send; # ready 2 + $sig->send; # remember print +(Coro::Semaphore::count $sig) == 1 ? "" : "not ", "ok 1\n"; - cede; + cede; # execute 3 (already ready, no contention), 1, 2 - print +(Coro::Semaphore::count $sig) == 0 ? "" : "not ", "ok 3\n"; + print +(Coro::Semaphore::count $sig) == 0 ? "" : "not ", "ok 5\n"; $sig->send; cede; - print +(Coro::Semaphore::count $sig) == 0 ? "" : "not ", "ok 5\n"; + print +(Coro::Semaphore::count $sig) == 0 ? "" : "not ", "ok 7\n"; $sig->broadcast; - print +(Coro::Semaphore::count $sig) == 0 ? "" : "not ", "ok 6\n"; + print +(Coro::Semaphore::count $sig) == 0 ? "" : "not ", "ok 8\n"; cede; - print +(Coro::Semaphore::count $sig) == 0 ? "" : "not ", "ok 7\n"; + print +(Coro::Semaphore::count $sig) == 0 ? "" : "not ", "ok 10\n"; }