in reply to Re: Perl detached threads, loops & my?
in thread Perl detached threads, loops & my?
use threads; do("./sql.pl"); #NOT INCLUDED IN EXAMPLE $thr4 = threads->new(\&processor); $thr4->detach(); sub processor{ my $select; $select = qq~ select * from pool_process where any="1" and status +="" order by id asc limit 1; ~; while (1){ if ($sys_ok == 1){ sleep(1); my @row = &row_sql($select,-1); if (!(@row)){ #pass }else{ &del_sql(qq~ update pool_process set status = "RUNNING",proc +_srv="$server_id" where id="@row[0]"; ~,-1); print "Processing (@row[1],@row[2],@row[3],@row[4])\n"; $used_threads++; my $thr =threads->new(\&process_start,@row[1],@row[2],@row[3 +],@row[4],@row[5],@row[6],@row[7],@row[0]); $thr->detach(); if (@row[4] eq "generate_details"){ sleep(3); } } }else{ sleep(30); } } } sub process_start{ my $return_code = system(qq~ perl ./thread_process.pl "$_[0]" "$_[ +1]" "$_[2]" "$_[3]" "$_[4]" ~); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl detached threads, loops & my?
by BrowserUk (Patriarch) on Jun 09, 2010 at 02:23 UTC | |
|
Re^3: Perl detached threads, loops & my?
by rjt (Curate) on Jun 09, 2010 at 03:08 UTC |