- Timestamp:
- 04/15/06 05:48:11 (3 years ago)
- Files:
-
- 1 modified
-
trunk/POE-Component-Pool-Thread/t/pre_interface.t (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/POE-Component-Pool-Thread/t/pre_interface.t
r13 r22 1 #!/usr/bin/perl -l1 #!/usr/bin/perl 2 2 3 3 use strict; 4 4 use warnings FATAL => "all"; 5 # use Test::Simple tests => 200;6 use Test;7 use threads;8 use Thread::Semaphore;9 5 10 BEGIN { plan tests => 200 } 6 our $TOTAL_JOBS; 7 BEGIN { $TOTAL_JOBS = 100 } 8 use threads; # must be loaded before Test::Simple 9 use Test::Simple tests => 2*$TOTAL_JOBS; 11 10 12 11 use POE qw( Component::Pool::Thread ); 13 14 our $semaphore = new Thread::Semaphore;15 12 16 13 POE::Component::Pool::Thread->new … … 32 29 $kernel->yield(run => $i); 33 30 34 if ($i < 100) {31 if ($i < $TOTAL_JOBS) { 35 32 $kernel->yield(loop => $i + 1); 36 33 … … 48 45 select undef, undef, undef, rand 0.5; 49 46 50 $semaphore->down; 51 ok $point; 52 $semaphore->up; 47 ok(1, "thread_entry_point $point"); 53 48 54 49 return $point; … … 58 53 my ($kernel, $result) = @_[ KERNEL, ARG0 ]; 59 54 60 $semaphore->down; 61 ok($result + 100); 62 $semaphore->up; 55 ok(1, "response $result\n"); 63 56 64 if ($result == 100) {57 if ($result == $TOTAL_JOBS) { 65 58 $kernel->yield("shutdown"); 66 59 }