Re: threads package status

From: Date: Mon, 19 Jul 2004 23:16:20 +0000
Subject: Re: threads package status
References: 1 2 3 4  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-988@lists.php.net to get a copy of this message
http://us4.php.net/manual/en/ref.pcntl.php Im using this to create a "threaded" xml socket server for flash. Where you might have a problem is inter-process communication, I use a combination of shared memory and semaphore's to manage that. Andrey Hristov wrote:
Robert Janeczek wrote:
Wez Furlong wrote:
Don't hold your breath waiting for it to become stable enough; threads and PHP don't really mix very well, and thats due to the whole architecture of PHP; not something that can be fixed very easily without rewriting everthing.
that`s sad :( my thesis is based on making php to use threads somehow :]
Of course, if someone fixes the bug you mentioned and you find and it all works for you, keep using PHP, but otherwise it's better to use something else; either don't use threads (try sockets?) or don't use PHP :-/
in my project there is no real option for threads :( i tried to get somehow around this problem - wanted even to use something from java (but couldn`t get java package to work at all). i saw your name along threads package commiters, so maybe you could say if there is something difficult with implementing simple threading pool extension like that: array containing php callbacks guarded by mutex, threads lock on this mutex, producer adds callbacks to the array. threads do simple fetching from array and call_user_func(). is it doable in php? what kind of traps do you see in this solution?
Isn't it possible to use fork() (sorry but only *nix). In PEAR (our lovely repository) there is Net_Server package. It includes "server" that does preforking - example how to fork. Also I think that there in PEAR there is some Fork package. Mutex you can make by using ext/sysvsem. For the callbacks ext/sysvshm may help. Also one can use ext/sysvmsg for sending messages with "tasks" (i used to implement such a "distributed" architecture example (if you are interested I can provide you more information).
rash
cheers, andrey


« previous php.pecl.dev (#988) next »