Ignore:
Timestamp:
2013-03-05T11:04:38+13:00 (11 years ago)
Author:
jmt12
Message:

Attempting to make thread joining code compatiable between core perl and MCPAN perl with the slightly different threads module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/tdb-edit/trunk/src/perllib/SocketsSwimmingThreadPoolServer.pm

    r25497 r26997  
    163163  }
    164164  # Properly rejoin thread
    165   my $thread = threads->self();
    166   if (!$thread->is_detached())
    167   {
    168     $thread->join();
     165  # Newer versions of module thread
     166  if (defined $self->can('is_joinable'))
     167  {
     168    print "[debug] using newer thread->is_joinable... ";
     169    if ($self->is_joinable())
     170    {
     171      $self->join();
     172      print "joined\n";
     173    }
     174    else
     175    {
     176      print "not joinable\n";
     177    }
     178  }
     179  else
     180  {
     181    print "[debug] using newer thread::is_detached... ";
     182    my $thread = threads->self();
     183    if (!$thread->is_detached())
     184    {
     185      $thread->join();
     186      print "joined\n";
     187    }
     188    else
     189    {
     190      print "not detached\n";
     191    }
    169192  }
    170193}
Note: See TracChangeset for help on using the changeset viewer.