local $SIG{HUP} = 'IGNORE'; $SIG{HUP} = \&SIGKILL_handler; while ( $#todo >= 0 && $result == 0) { last if($result > 0); my $cmd = pop(@todo); $sem->down(); # nur n Tasks gleichzeitig if ( $result == 0) { my $thread = threads->new( \&Task, $cmd, # neuen Thread erzeugen ); } } #------------------------------------------------------------------------- sub Task { my ( $cmd, # Parameter ) = @_; my $id = threads->self->tid; $thread_run++; $result += system ($cmd)/256;; if ($debug == 1) { print " Return: $result \n\n"; } $sem->up(); $thread_run--; printf "Thread %02d: fertig.\n", $id; if ($result >0){print "\n\n Fehler !!!!!!!!\n\n"; kill ("HUP", -$$); } } #------------------------------------------------------------------------- sub SIGKILL_handler { print "SIG_KILL\n"; kill ("HUP", -$$); }