Req #46919 [Com]: Multi threading
| From: | jose dot nobile at gmail dot com | Date: | Wed, 21 Mar 2012 22:09:47 +0000 |
| Subject: | Req #46919 [Com]: Multi threading | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-168705@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
Comment by: jose dot nobile at gmail dot com
Reported by: n0valyfe at gamergrid dot net
Summary: Multi threading
Status: Open
Type: Feature/Change Request
Package: Feature/Change Request
Operating System: All
PHP Version: 5.2.8
Block user comment: N
Private report: N
New Comment:
How many year the PHP community will wait for <?PHP new Thread?>
Previous Comments:
------------------------------------------------------------------------
[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