Changeset 360

Show
Ignore:
Timestamp:
05/24/07 17:00:15 (1 year ago)
Author:
kindlund
Message:

Experimental testing w/ improved thread memory handling.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/exp/kindlund-filesystem/lib/HoneyClient/Agent.pm

    r352 r360  
    682682    } else { 
    683683        print "Thread is NOT running.\n"; 
     684        print "Joining dead thread...\n"; 
     685# XXX: Check to see if this works. 
     686        threads->object($tid)->join(); 
     687        print "Finished dead thread join!\n"; 
    684688    } 
    685689} else { 
     
    802806                $data->{$driverName}->{'state'} = $driver; 
    803807 
    804                 if ($driver->isFinished()) { 
    805                     # Thread is about to finish, set the ID back to undef. 
    806                     # This looks ugly, but setting it this early avoids the 
    807                     # potential race condition of when the run() thread is finished 
    808                     # and when updateState() checks for $driverData->{$driverName}->{'thread_id'} 
    809                     # to be set to undef. 
    810                     $data->{$driverName}->{'thread_id'} = undef; 
    811                 } 
     808# XXX: Check to see if this is okay. 
     809#                if ($driver->isFinished()) { 
     810#                    # Thread is about to finish, set the ID back to undef. 
     811#                    # This looks ugly, but setting it this early avoids the 
     812#                    # potential race condition of when the run() thread is finished 
     813#                    # and when updateState() checks for $driverData->{$driverName}->{'thread_id'} 
     814#                    # to be set to undef. 
     815#                    $data->{$driverName}->{'thread_id'} = undef; 
     816#                } 
    812817 
    813818                # Release lock on stored driver state. 
     
    895900  
    896901                # Thread is about to finish, set the ID back to undef. 
    897                 $data->{$driverName}->{'thread_id'} = undef; 
     902# XXX: Check to see if this is okay. 
     903#                $data->{$driverName}->{'thread_id'} = undef; 
    898904 
    899905                # Release lock on stored driver state. 
     
    929935                  
    930936                # Make sure we update our state to reflect ourself dying. 
    931                 $data->{$driverName}->{'thread_id'} = undef; 
     937# XXX: Check to see if this is okay. 
     938#                $data->{$driverName}->{'thread_id'} = undef; 
    932939 
    933940                # Release lock on stored driver state. 
     
    952959             
    953960        # Set the valid thread ID. 
     961        $data->{$driverName}->{'thread_id'} = $thread->tid(); 
    954962        if ($thread->is_running()) { 
    955963            # XXX: Debugging, remove eventually.  
    956964            print "Thread ID = " . $thread->tid() . "\n"; 
    957             $data->{$driverName}->{'thread_id'} = $thread->tid(); 
     965            #$data->{$driverName}->{'thread_id'} = $thread->tid(); 
    958966        } else { 
    959967            # XXX: Debugging, remove eventually.  
    960             print "Thread ID = undef\n"; 
    961             $data->{$driverName}->{'thread_id'} = undef; 
     968            print "Thread ID = " . $thread->tid() . " (NOT RUNNING)\n"; 
     969            #print "Thread ID = undef\n"; 
     970            #$data->{$driverName}->{'thread_id'} = undef; 
    962971        } 
    963972