Re: phpthreads - hints anyone...
| From: | Alan Knowles | Date: | Mon, 05 Aug 2002 04:31:15 +0000 |
| Subject: | Re: phpthreads - hints anyone... | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-86524@lists.php.net to get a copy of this message | ||
Andi Gutmans wrote:
At 11:36 PM 8/4/2002 +0200, Edin Kadribasic wrote:+100 here - the more you think about it, alot of times all you want to do is run some simple 'fetch url or something' in the thread, And the include version should be very lightweight.. - it's also very 'phpish :)' ... include().. I was also thinking about 'eval()', which would bridge the two.. thread_eval('include("mythreadclass.php");$x = new mythreadclass(); $x->run()'); or thread_eval('thread_set_data('php.net', file_get_contents("http://www.php.net"))'); As far as the copying opcodes - from my hacking away at bcompiler - from what I remember I stripped out the code in apc that had ability to copy opcodes, so that may save a bit of work.. - and it can be used as it's under php licence now.... regards alanI think this is voodoo and will be less straightforward to the end-userI'm thinking less about voodoo or magic, and more about what thenaturalapproach 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 don't think having threads by file would be that useful. If it is difficult to implement "real" threading in PHP we should IMHO leave it alone.I don't mind leaving it, because I'm not sure it's very important anyway, especially for the web. But why isn't thread per file useful? Usually the thread is a separate function which does its own thing and is quite self contained.
Andi