6 if (! $Config{'useithreads'}) {
7 print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
14 use Thread::Semaphore;
17 require 't/test.pl'; # Test::More work-alike for Perl 5.8.0
24 # The following tests locking a queue
26 my $q = Thread::Queue->new(1..10);
29 my $sm = Thread::Semaphore->new(0);
30 my $st = Thread::Semaphore->new(0);
38 select(undef, undef, undef, 0.1);
39 my @x = $q->extract(5,2);
40 is_deeply(\@x, [6,7], 'Thread dequeues under lock');
46 my @x = $q->dequeue_nb(100);
47 is_deeply(\@x, [1..5,8..10], 'Main dequeues');