Waynn Lue wrote:
Here's pseudo code for what I'm trying to do:
foreach ($things as $thing) {
info = getInfo($thing); // uses a db connection
makeApiCall(info);
}
makeApiCall(info) {
$pid = pcntl_fork();
if ($pid == -1) {
die(could not fork);
} else if ($pid) {
//
Here's pseudo code for what I'm trying to do:
foreach ($things as $thing) {
info = getInfo($thing); // uses a db connection
makeApiCall(info);
}
makeApiCall(info) {
$pid = pcntl_fork();
if ($pid == -1) {
die(could not fork);
} else if ($pid) {
// parent,
Waynn Lue wrote:
I actually tried this in the meantime:
$pid = pcntl_fork();
if ($pid == -1) {
die(could not fork);
} else if ($pid) {
// parent, return the child pid
echo child pid $pid waiting\n;
pcntl_waitpid($pid, $status);
if (pcntl_wifexited($status)) {
Waynn Lue wrote:
Ah, I was changing it to waiting for each child to finish in order to
see if I could narrow down my db problem, because I figure this should
be more or
less equivalent to running it synchronously. Even like this, though,
it still causes the db problem.
I think the database
I think your waitpid() is in the wrong place, and at least you need use
WNOHANG - unless you specifically want to wait for each child to finish
before starting another one.
But it still has the same problem, and I'm also trying to avoid
pcntl_wait or pcntl_waitpid at all because I still
Waynn Lue wrote:
I periodically run a script that makes a call against a remote API,
which
takes some time to return. In an attempt to increase thoroughput, I
decided to investigate using pnctl_fork to spawn off multiple
processes to make the call, since the slowest part is the network part
Waynn Lue wrote:
I periodically run a script that makes a call against a remote API,
which
takes some time to return. In an attempt to increase thoroughput, I
decided to investigate using pnctl_fork to spawn off multiple
processes to make the call, since the slowest part is the
Waynn Lue wrote:
While this works, it unfortunately leaves behind a zombie process
every single time.
You need to call pcntl_wait() or pcntl_waitpid().
Right, but if I do that, then the parent has to wait until the child
completes before it exits.
No it doesn't - just call
While this works, it unfortunately leaves behind a zombie process
every single time.
You need to call pcntl_wait() or pcntl_waitpid().
Right, but if I do that, then the parent has to wait until the child
completes before it exits.
No it doesn't - just call pcntl_wait() with
bruce wrote:
Hi Nathan/Torok...
Hey guys... got a bit of a question.
I'm playing around with the php/for/pcntl_exec functions and I've got
a process that spawns off a bunch of child processes. Unfortunately,
I'm getting to where I have 100's of zombie child processes that I can
see from
Not sure if anyone is interested in what I have come up with, its busy
running just now but it seems to be performing ok.
$do =0;
$ok =0;
$count=0;
while($do!=1){
if($ok==0){
$sql = SELECT * FROM locations WHERE parent = '0' AND doing=0 and
done !=1 ORDER BY num DESC
On Tue, 2004-09-21 at 13:58, John Wards wrote:
Not sure if anyone is interested in what I have come up with, its busy
running just now but it seems to be performing ok.
Again adding to this thread for future reference.
Its just compleated all 90 threads in 1 hour 50 minutes and that was
Hi, I have a bit of a cold today so I probably would have figured this
out for myself eventually but hey ;-)
Right I have a script that I need to run around 90 times thru a cron job
but passing a different i.d. to it each time.
I have experimented with running all 90 at once and its a no
On Mon, 2004-09-20 at 16:45, Wouter van Vliet wrote:
What I would like to do is fork off say 5-10 at a time and when one is
done start another one in its place, as they all take different length
of times to compleate.
Any clues at where to start? Here is my fork all 90+ code...
play around with popen() and stream_select()
John Wards wrote:
Hi, I have a bit of a cold today so I probably would have figured this
out for myself eventually but hey ;-)
Right I have a script that I need to run around 90 times thru a cron job
but passing a different i.d. to it each time.
I have
On Mon, 2004-09-20 at 16:56, Marek Kilimajer wrote:
play around with popen() and stream_select()
Oooh that looks handy.
More night time reading I think!
Any further ideas to save a man with a cold from using his brain would
be great!
Cheers
John
--
PHP General Mailing List
John Wards wrote:
Hi, I have a bit of a cold today so I probably would have figured this
out for myself eventually but hey ;-)
Right I have a script that I need to run around 90 times thru a cron job
but passing a different i.d. to it each time.
not suprised.
I have experimented with running
On Mon, 20 Sep 2004 16:36:51 +0100, John Wards [EMAIL PROTECTED] wrote:
Right I have a script that I need to run around 90 times thru a cron job
but passing a different i.d. to it each time.
I have experimented with running all 90 at once and its a no go as it
just makes the server run to
John Wards wrote:
On Mon, 2004-09-20 at 16:56, Marek Kilimajer wrote:
play around with popen() and stream_select()
Oooh that looks handy.
More night time reading I think!
Any further ideas to save a man with a cold from using his brain would
be great!
Cheers
John
Wanted to do something
That's one of the main reasons you would want to use the mail() function.
I wouldn't advise a fork() here, but if you really insist, see the pcntl
extension - http://php.net/pcntl
-Rasmus
On Wed, 12 Jun 2002, Nathan Cassano wrote:
Hi PHP folks,
I have a program that sends out email by
Vulcan Logic SRM
www.vl-srm.net
Every your task is a banana.
Regards,
Andrey Hristov
- Original Message -
From: Paul Roberts [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, February 23, 2002 1:05 PM
Subject: [PHP] fork?
how do i do two things at the same time, i'm thinking
21 matches
Mail list logo