How long are the TSRMLS_D/C parameters good for?

The life of a given thread.

Can the resultant tsrm_ls value be safely stored?

Yes, but only during the life of a thread. For practical purposes, you should consider this to mean the life of a request since there is no guarantee that subsequent requests will be serviced by the same thread.

I presume the answer is no, and these paramters
should be passed in each time a function is called,
but I would be curious to know differently, if for example
it could be passed in once at (external object) creation time,
and that object could use the trsm_ls directly, rather than the
TSRMLS_D/C semantics.

Yes, and I've done that on more than one occasion.

A given tsrm_ls value is tied to a thread (and uniquely identifies that thread). Since a given request never jumps from one thread to another (It stays in the thread it was born in), the tsrm_ls you get at one point in a request will be the tsrm_ls you get at another point in a request.

-Sara
http://blog.libssh2.org/index.php?/archives/22-What-the-heck-is-TSRMLS_CC-anyway.html
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to