Attempt to free unreferenced scalar: SV 0x12289c at /opt/ActivePerl-5.8.2/lib/site_perl/5.8.2/sun4-solaris-thread-multi/DBI.pm line 626. Attempt to free unreferenced scalar: SV 0x12289c at /opt/ActivePerl-5.8.2/lib/5.8.2/sun4-solaris-thread-multi/IO/Socket.pm line 46. #### sub mydie{ kill "SIGTERM", $$; # suicide! } #### my ($data, $dbh); my %locks : shared = (); my $childs = new Thread::Semaphore(2); my $db; # Database-Hash # my %results; # Hash for results-db my %jobs; # additional information # if marked here, job will not be tryed again today my %jobs_done : shared = (); # associate hash with Database $db = tiedb(); my $jobs = 0; while(1){ # which job to do next? my ($id,$time) = get_next_job_Id_And_Frequency(); /* look up into a table */ last unless $id; $jobs++; do_job($id, $time); } # cleaning up $childs->down($maxchilds); close LOCK or mydie("cant close $lockfile: $!"); unlink $lockfile or mydie("cant delete $lockfile: $!"); sub do_job { my ($id, $time) = @_; $childs->down(); my $thread = threads->create(\&the_job, $id, $time); $thread->detach(); } sub the_job { lock(%jobs_done); $jobs_done{$id} = 1; // Some Job is made here If Failure then kill "SIGTERM", $$; # suicide! $childs->up(); # increment semaphore } sub tiedb{ my %db; tie %db, 'Tie::DBI', { db => $db_source, table => $db_table, key => 'id', user => $db_user, password => $db_passwd, CLOBBER => 1, AUTOCOMMIT => 1, # DEBUG => 1, }; # set DATE-format from Database my $dbh = tied(%db)->dbh; my $handle = $dbh->prepare($db_setdate); $handle->execute(); $handle->finish(); return \%db; }