Alan Knowles wrote:
> Ok, had a slight play with it again..
> 
> I did eventually find the perl code for threading although without an 
> lxr server it's pretty much impossible to decipher all the macros they 
> use..

It's not about looking at the perl code, that will tell you nothing 
unless you know perl internals.  It's about the way the interpreter 
works, some of the architecture, that is simular to PHP.  In PHP, 
threads are isolated, kind of like seperate processes, but in threads. 
Everything in PHP works that way, so in creating threads for php 
scripts, you have to have a seperate interpreter.  Then you have to 
create a "bridge" between the threads for shared variables.  shmop comes 
close to what is needed, but not close enough.

> The code for this stuff is pretty simple at the moment.. - so i'ts down 
> the bottom..

You're much closer to what needs to happen now.  But you cannot simply 
point to the memory for another thread.  Doing that will cause problems 
like you are running into.  You actually have to copy a bunch of stuff 
so each thread is completely independent.

I've worked up some code in TSRM to abstract native thread calls, and 
have started on an extension, but probably won't have it complete until 
this weekend some time.  What you've done now is fairly simular, but 
pthread specific.  Given time, I might have enough done to email a diff 
containing my work tomorrow night if you want to take a look.

Shane


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to