Re: phpthreads - hints anyone...

From: Date: Sun, 04 Aug 2002 19:06:34 +0000
Subject: Re: phpthreads - hints anyone...
References: 1 2 3 4 5 6 7 8  Groups: php.dev 
Request: Send a blank email to php-dev+get-86510@lists.php.net to get a copy of this message
Andi Gutmans wrote:
At 11:16 PM 8/3/2002 -0700, Shane Caraveo wrote:
Andi Gutmans wrote:
I still think that if you're going to implement such a thread extension it shouldn't try and copy it's parents data-structures. It'd be very slow and prone to errors.
Andi, Currently only the thread_include function that Alan wrote works. I have idea's for doing the other thing without having to copy stuff, and without using mutexes in the engine. Basicly, the idea is to recompile the file, but rather than start execution as normal, call into a function within the file. This gets us a middle ground that makes starting the thread easy, while allowing a function to be the target of the thread start function (which I *realy* prefere).
I think this is voodoo and will be less straightforward to the end-user as you're not going to manage to compile include files and other things. So you're basically saying, you want to try and make it work magically but it might not work very well. I prefer the keep it simple approach where the user specifies a file.
I'm thinking less about voodoo or magic, and more about what the natural approach as a developer is. Treating a file as a thread, which while easier to implement, is not a normal method of initiating a thread, at least not with any language I've used. It may come down to the fact that doing threads by file is the only way to make it work well, but I think it's worth the investigation to see if a better way is doable.
I'm also thinking that it might be possible to set up a 'shared' interpreter on it's own thread that doesn't run anything, but is just used to store zval's for the other threads. When a thread_set/get is called, it actually comunicates with this extra thread to set/get the shared vars.
Hmm I don't quite understand this idea. Why would you need a shared interpreter and not just a shared symbol table? Can you please explain this again? Thanks, Andi
We need a mechanism to store zval's persistently until the entire 'request' is done. If a shared symbol table will do it, then that solves the problem. Shane

« previous php.dev (#86510) next »