On Mon, May 14, 2012 1:47 pm, David Rueter wrote:
> I am interested in preserving the complete PHP context for a thread
> (globals,
> variables, interpreter, etc.--everything) for later access from a
> different
> thread.
>
> What would be involved in this?  It seems like:
>
> 1) Avoid calling ts_free_thread
> 2) Call tsrm_set_interpreter_context from new thread
>
> Is it safe to assume that the context of a terminated thread will not
> be
> destroyed or overwritten as long as ts_free_thread is not called?

I don't really know what I'm talking about, but nobody has answered
yet...

For starters, not all extensions are thread-safe. I would expect that
to mean that anything actively using those extensions saved state in
another thread is a segfault waiting to happen.

For security reasons and sheer plain cussedness, I don't think you're
going want and/or get any resource (mysql connection/result/etc, gd
images, file handles, etc) survive to the next thread.  A mysql
connection, for example, is opened with a specific user/pass. Another
thread picking this up could probably abuse that, as I understand it.

Finally, your question begs another question:

Why do you want to do this?

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE



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

Reply via email to