Re: Will PHP6 have threads (yet)?
| From: | David Tulloh | Date: | Tue, 21 Mar 2006 12:49:28 +0000 |
| Subject: | Re: Will PHP6 have threads (yet)? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-232316@lists.php.net to get a copy of this message | ||
Daevid Vincent wrote:
> It would be fantastic if PHP 6 was multi-threaded so you could spin threads
> to do simultaneous tasks. Is there any plans for this?
I think that this was last dicussed in December
http://www.zend.com/zend/week/week266.php#Heading5,
the conclusion was no.
For simultaneous tasks you can use process control via pcntl_fork().
>
> It would also be great if you could exec() or system() a program to run
> without blocking on a return. Sometimes I just want some other task to
> happen independantly without waiting (for example, call a program that *IS*
> threaded).
This isn't multithreading, this is using a background process.
You can do this using system() or exec() with the standard shell
backgrounding &. I assume you have to do it differently in windows.
You could also try pcntl_exec().
>
> Many other languages including JAVA, Perl, Python and Ruby are all
> multi-threaded, and it's a continuing source of frustration that PHP isn't.
>
Different tools are for different jobs. If you are trying to write a
listen server that creates threads to handle incoming requests or
something similar, I'd recomend not using PHP. For a webpage, threads
typically aren't required.
David Tulloh