Changeset 11050


Ignore:
Timestamp:
03/10/10 14:55:56 (2 years ago)
Author:
Sewi
Message:

Workaround the exit-failure problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/TaskManager.pm

    r11040 r11050  
    426426    my @workers = $self->workers; 
    427427    $self->task_queue->insert( 0, ("STOP") x scalar(@workers) ); 
    428     while ( threads->list(threads::running) >= 2 ) { 
    429         $_->join for threads->list(threads::joinable); 
    430     } 
     428 
     429    my $loopcount; 
     430# Changing the selection seems to solve the endless-loop problem 
     431#   while ( threads->list(threads::running) >= 2 ) { 
     432    while ( threads->list(threads::joinable) >= 2 ) { 
     433        for (threads->list(threads::joinable)) { 
     434            $_->join; 
     435        } 
     436        last if $loopcount > 125; # Wait no more than two minutes 
     437        # Pass time slices to the threads for finishing 
     438        sleep 1 if ++$loopcount > 5; 
     439    } 
     440 
    431441    foreach my $thread ( threads->list(threads::joinable) ) { 
    432442        TRACE( 'Joining thread ' . $thread->tid ) if DEBUG; 
Note: See TracChangeset for help on using the changeset viewer.