[Changed subject, I missed this thread until now because of it...]

I assume this difference between 1&2 and 3 is _strictly_ performance, and
_nothing_ else?

And a note for others: You don't need TSRML* in every function, but you do
need it if you use:
- Global variables, like BG(...) & co.
- Use a function which is declared TSRMLS_C[C] in your function
- more?

Greetz,
Jeroen

"Zeev Suraski" <[EMAIL PROTECTED]> wrote in message
news:5.1.0.14.2.20010826123513.03102660@localhost...
> 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()?
> >
> >
> > > -             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: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> Zeev Suraski <[EMAIL PROTECTED]>
> CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to