6 if (! $Config{'useithreads'}) {
7 print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
16 require 't/test.pl'; # Test::More work-alike for Perl 5.8.0
23 my $q = Thread::Queue->new(1..10);
26 $q->enqueue([ qw/foo bar/ ]);
30 is($q->peek(3), 4, 'Peek at queue');
31 is($q->peek(-3), 9, 'Negative peek');
33 my $nada = $q->peek(20);
34 ok(! defined($nada), 'Big peek');
35 $nada = $q->peek(-20);
36 ok(! defined($nada), 'Big negative peek');
38 my $ary = $q->peek(-1);
39 is_deeply($ary, [ qw/foo bar/ ], 'Peek array');
41 is($q->pending(), 11, 'Queue count in thread');
46 threads->create('q_check')->join();