Re: Multithreading for OOP PHP
| From: | Matijn Woudt | Date: | Wed, 31 Oct 2012 19:21:00 +0000 |
| Subject: | Re: Multithreading for OOP PHP | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319640@lists.php.net to get a copy of this message | ||
On Wed, Oct 31, 2012 at 11:37 AM, Florian Müller
<florian-mueller@outlook.com> wrote:
> I actually tought about just the same structures as Java uses(something in this way:
> Thread t = new Thread(new Runnable() { public void run() { ....blabla }}
> I thought this would actually be a good benefit if PHP supported this. It's just as we
> sometimes use PHP for doing some big Server works (e.g. database copying or something) and it would
> be nice to controll by yourself which Thread (or process) does which part of the job.
> For normal HTTP calls which must be handled within milliseconds, this actually does not make
> sense, that's right ;)
>
Hi,
Have you seen the pcntl[1] and pthreads[2] extensions?
pcntl extension provides a pcntl_fork function, which is also some
kind of threading. Pthreads is almost like it's Java equivalent.
- Matijn
[1] http://www.php.net/manual/en/book.pcntl.php
[2] http://www.php.net/manual/en/book.pthreads.php
Ps. Please don't top post on this mailing list.