Changeset 22

Show
Ignore:
Timestamp:
04/15/06 05:48:11 (3 years ago)
Author:
integral
Message:

Converted t/pre_interface.t to Test::Simple which claims thread-safety when
threads.pm is loaded before it.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/POE-Component-Pool-Thread/t/pre_interface.t

    r13 r22  
    1 #!/usr/bin/perl -l 
     1#!/usr/bin/perl 
    22 
    33use strict; 
    44use warnings FATAL => "all"; 
    5 # use Test::Simple tests => 200; 
    6 use Test; 
    7 use threads; 
    8 use Thread::Semaphore; 
    95 
    10 BEGIN { plan tests => 200 } 
     6our $TOTAL_JOBS; 
     7BEGIN { $TOTAL_JOBS = 100 } 
     8use threads; # must be loaded before Test::Simple 
     9use Test::Simple tests => 2*$TOTAL_JOBS; 
    1110 
    1211use POE qw( Component::Pool::Thread ); 
    13  
    14 our $semaphore = new Thread::Semaphore; 
    1512 
    1613POE::Component::Pool::Thread->new 
     
    3229        $kernel->yield(run => $i); 
    3330 
    34         if ($i < 100) { 
     31        if ($i < $TOTAL_JOBS) { 
    3532            $kernel->yield(loop => $i + 1); 
    3633 
     
    4845    select undef, undef, undef, rand 0.5; 
    4946 
    50     $semaphore->down; 
    51     ok $point; 
    52     $semaphore->up; 
     47    ok(1, "thread_entry_point $point"); 
    5348 
    5449    return $point; 
     
    5853    my ($kernel, $result) = @_[ KERNEL, ARG0 ]; 
    5954 
    60     $semaphore->down; 
    61     ok($result + 100); 
    62     $semaphore->up; 
     55    ok(1, "response $result\n"); 
    6356 
    64     if ($result == 100) { 
     57    if ($result == $TOTAL_JOBS) { 
    6558        $kernel->yield("shutdown"); 
    6659    }