Re: cvs: php4 /main streams.c
| From: | Zeev Suraski | Date: | Sun, 26 Aug 2001 09:39:49 +0000 |
| Subject: | Re: cvs: php4 /main streams.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-7072@lists.php.net to get a copy of this message | ||
The thread safety macros pass around a context that the rest of the thread safety macros use. There are three types of such macros:
1. Macros that are used in function declarations, to denote that the function accepts this context as an argument:
TSRMLS_D - if it's the only argument (Thread Safe Resource Manager Local Storage, Declaration)
TSRMLS_DC - if it's not the only argument (Thread Safe Resource Manager Local Storage, Declaration with Comma)
2. Macros that are used in function calls, to pass the context to functions that accept it:
TSRMLS_C - if it's the only argument (Thread Safe Resource Manager Local Storage, Call)
TSRMLS_CC - if it's not the only argument (Thread Safe Resource Manager Local Storage, Call with Comma)
3. If the context cannot be passed using function arguments (e.g., in certain callbacks), it can be obtained by calling TSRMLS_FETCH() at the end of the variable declarations (Thread Safe Resource Manager Local Storage Fetch)
For performance reasons, using 1+2 is usually preferred to using 3.
Zeev
At 12:07 26-08-01, Joey Smith wrote:
I really don't understand the thread-safety stuff, but shouldn't this also be using TSRMLS_CC instead of TSRMLS_FETCH()?-- Zeev Suraski <zeev@zend.com> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/- TSRMLS_FETCH();-/* these names depend on the values of the PHP_STREAM_AS_XXX defines in php_streams.h */ static const char * cast_names[3] = { "STDIO FILE*", "File Descriptor", "Socket Descriptor" }; + TSRMLS_FETCH();+zend_error(E_WARNING, "%s(): cannot represent a stream of type %s as a %s", get_active_function_name(TSRMLS_C), stream->ops->label,-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net For additional commands, e-mail: php-cvs-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net