5 if ($ENV{'PERL_CORE'}){
7 unshift(@INC, '../lib');
10 if (! $Config{'useithreads'}) {
11 print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
18 use Thread::Semaphore;
21 require 't/test.pl'; # Test::More work-alike for Perl 5.8.0
28 # The following tests locking a queue
30 my $q = Thread::Queue->new(1..10);
33 my $sm = Thread::Semaphore->new(0);
34 my $st = Thread::Semaphore->new(0);
42 select(undef, undef, undef, 0.1);
43 my @x = $q->extract(5,2);
44 is_deeply(\@x, [6,7], 'Thread dequeues under lock');
50 my @x = $q->dequeue_nb(100);
51 is_deeply(\@x, [1..5,8..10], 'Main dequeues');