Ignore:
Timestamp:
2013-12-18T12:16:17+13:00 (10 years ago)
Author:
jmt12
Message:

Apparently trying to join() threads that have been detached() is actually wrong (detach means 'run this, I don't care about result' while join implies 'okay, wait until this is done and then return result'). Since I don't care about result values (they're always 1) I'll just remove the joining code since it doesn't seem to be portable to Medusa anyway

File:
1 edited

Legend:

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

    r28772 r28775  
    162162    $closed_queue->enqueue($n);
    163163  }
     164
     165  # Shouldn't join() detached threads?
    164166  # Properly rejoin thread
    165167  # 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     }
    192   }
     168  #if (defined $self->can('is_joinable'))
     169  #{
     170  #  print "[debug] using newer thread->is_joinable... ";
     171  #  if ($self->is_joinable())
     172  #  {
     173  #    $self->join();
     174  #    print "joined\n";
     175  #  }
     176  #  else
     177  #  {
     178  #    print "not joinable\n";
     179  #  }
     180  #}
     181  #else
     182  #{
     183  #  print "[debug] using newer thread->is_detached... ";
     184  #  my $thread = threads->self();
     185  #  if (!$thread->is_detached())
     186  #  {
     187  #    $thread->join();
     188  #    print "joined\n";
     189  #  }
     190  #  else
     191  #  {
     192  #    print "not detached\n";
     193  #  }
     194  #}
    193195}
    194196
Note: See TracChangeset for help on using the changeset viewer.