I've been playing around with the (not new) idea of introducing threads-one of the reasons to not try object stuff initially (although it was in the todo) was to try and find out the issues :) - more below....
into PHP userland (maybe something to think about havin in PHP6?). What
came out of it is available at [1], offering an object oriented API (in
comparison to PECL/threads [2]).
not totally given up.. - but it's kind of a low priority unfortunatly (as it would be very nice)Maybe someone here would like to pick up on this idea or give some directions to what would have to be done to make this actually work dependably. I'm experiencing the same issues as with PECL/threads - variable "confusion" (local function arguments with same names in two threads affect each other), Engine unstability (Warning: ... in ... on line -18182899), but could get a couple of samples[3] to work quite well.
Maybe the userland API could be adopted by PECL/threads? Is anyone still working at this or was development given up?
To try and go through some of the issues with threads: http://talks.php.net/show/kongress-gtk-future-2002/14 gives a few clues...
the reality is that all the zend_ctor... methods etc. are thread safe (assuming you compiled with the experimental zts flag) - this however introduces lots of problems when working with threads as the zend engine will allocate memory to the wrong thread, and hence try and free it when that thread closes.
what you demonstrated was the idea of copying the object instance from one thread to another (unfortunatly you also have to copy the object definition - eg. the opcodes) to make it work.. - whats worse is that you have to create memory that the engine doesnt know about.. - and then pass it too the new instance.. and tell the new instance that it is now incharge of that memory..
the idea of a thread_include() function was that it would be a starting point which would be idiot proof from the user (and less complex from the coding side..) - and would not involve the complexity of opcode replications (which would have to use something like the code in bcompiler..)
Hope this doesnt put you off.. - as I would still love to see it in PHPx somewhere :)
I guess the other issue was to try and ensure it was cross platform (as in reality most of those gtk apps are going to have to run on windows).. - so Shane did an amazing amount of work building the cross platform library..
Regards Alan
1] http://sitten-polizei.de/php/threads-0.1alpha.tar.gz 2] http://cvs.php.net/cvs.php/pear/PECL/threads 3] http://sitten-polizei.de/php/threads/tests/?file=mythread.php http://sitten-polizei.de/php/threads/tests/?file=timer.php http://sitten-polizei.de/php/threads/tests/?file=simple.php http://sitten-polizei.de/php/threads/tests/?file=calendar.php etc.
- Timm
--
Can you help out? Need Consulting Services or Know of a Job?
http://www.akbkhome.com
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php