Req #46919 [Opn->Wfx]: Multi threading
| From: | rasmus@php.net | Date: | Wed, 16 Jan 2013 21:54:05 +0000 |
| Subject: | Req #46919 [Opn->Wfx]: Multi threading | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176062@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=46919&edit=1
ID: 46919
Updated by: rasmus@php.net
Reported by: n0valyfe at gamergrid dot net
Summary: Multi threading
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: All
PHP Version: 5.2.8
Block user comment: N
Private report: N
New Comment:
This is not going to happen in PHP core, but it can be done through an extension.
One example is here: http://pecl.php.net/package/pthreads
Previous Comments:
------------------------------------------------------------------------
[2013-01-16 21:34:58] invictible at live dot co dot uk
I believe, that this would be a excellant addition to PHP as I've run into many situation where
multi-threading would have made it much more performant than simply running everything in one thread
where a single function taking it's time or other lengthy tasks can have a significant impact
on the time it takes the script to run.
------------------------------------------------------------------------
[2012-03-21 22:09:47] jose dot nobile at gmail dot com
How many year the PHP community will wait for <?PHP new Thread?>
------------------------------------------------------------------------
[2010-04-01 15:05:55] speedy dot spam at gmail dot com
What would be really great to have is something similar to classic pcntl_clone() linux kernel
function on the PHP level, accepting a function to be executed as a parameter and sharing all the
variables/state with the primary and other created threads.
Locking could be done with a simple and optional use of mutexes on the application level, if one
needs to view fully consistent state of a certain variable / array. (ie. otherwise, foreach() loop
while writing to an array in the other thread might not see some recently added entries)
As an idea, on the internal implementation side, copy-on-write semantics could be used with
read-only operations seeing the previous version while the write/modify operation is executed on a
copy.
Even if unstable at first (marked as experimental or some such), it would be a good starting point
for making PHP thread-safe, re-entrant, and multi-core compatible.
------------------------------------------------------------------------
[2008-12-21 19:39:34] n0valyfe at gamergrid dot net
Description:
------------
Would it be possible to add some sort of multithreading into PHP, say a new thread is created via a
function, to execute a function or object method in a new thread.
Keeping the scope intact, so that $this and global vars work inside that function in another thread.
I think this would benefit PHP in many ways, for instance a script wouldnt "hang" when
executing something that can take a while, it can just open a new thread.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=46919&edit=1