Re: TSRMLS_D/C persistence

From: Date: Sat, 01 Jul 2006 01:18:02 +0000
Subject: Re: TSRMLS_D/C persistence
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-24234@lists.php.net to get a copy of this message
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

« previous php.internals (#24234) next »