use threads; ... sub complete_host #<-Vaterthread { my $installdir = $_[0]; my $threadnr = $_[1]; while($hosts->pending() > 0) { my @temp = split(/;/, $hosts->dequeue_nb()); my $host = Host->new(\@temp); my $thread = threads->new(\&scan_host, $host->get("hostip"), $threadnr); #<-Kindthread, startet nmap $thread->detach(); my $timestamp = time(); my $now = ""; my $remain = ""; do { $now = time(); $remain = $now - $timestamp; if($remain > 60) { print "Subthread in Thread ".$threadnr." wird gekillt!\n"; $thread->exit('STOP'); # $thread->kill(); } } while($thread->is_running()); #werte die XML aus bzw scanne neuen Host }