RE: [PHP] I want to write a Multi-threaded PHP Application
| From: | Richard Lynch | Date: | Wed, 26 Apr 2006 23:17:03 +0000 |
| Subject: | RE: [PHP] I want to write a Multi-threaded PHP Application | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234890@lists.php.net to get a copy of this message | ||
On Wed, April 26, 2006 6:05 pm, Warren Vail wrote:
> "not likely" until at least PHP 8.0. However, my needs for a thread
> are
> very simple and might be able to avoid the complexities of shared
One thing you could consider...
If you had one "main" script that did a stream_select on multiple URLs
and polled them to get their output as it came about, you'd
essentially be using Apache's multi-process model instead...
Or you could just figure out what was wrong that was causing your
zombies and fix it... :-v
Another nifty hack is:
//An atomic way to claim these tasks as MINE
$process_id = getmypid();
$query = "UPDATE tasks set process_id = $process_id WHERE process_id
is NULL LIMIT 10";
You can then do the 10 tasks needed and die off.
Alter 10 to suit your needs, and have not as many php processes
running in parallel.
--
Like Music?
http://l-i-e.com/artists.htm