Chris Hope <bl*******@electrictoolbox.com> wrote in message news:<7x******************@news.xtra.co.nz>...
OutsiderJustice wrote:
I can not find any information if PHP support multi-thread (Posix
thread) or not at all, can someone give out some information? Is it
supported? If yes, where's the info? If no, is it possible to make
doing multi-thread stuff?
You can do it, but don't try doing it when it's a script on a webserver.
Check out the following links (the 1st one is the PHP manual; the 2nd one
is a link on my website about how to do just this):
http://www.php.net/pcntl
http://www.electrictoolbox.com/artic...ocess-forking/
Chris
Unfortunately there are so many problems with it:
- it is not really multi-thread, it's multi-process, it's expensive to
duplicate all resources in the child process
- it is only available on UNIX system; even so, if one forgot to do
'--enable-pcntl' when compiling PHP, one has to compile it again,
which can be a hassle.
I'm not a Windows guy, but I believe Windows also has it's own process
control APIs, so I'm kind of wondering why this is not implemented on
Windows version.
Is there anything may be useful to achieve multi-thread performance on
Windows system?
Yufeng