Re: Re: How do I save TSRMLS_CACHE for a new thread in PHP7?
| From: | Ángel González | Date: | Wed, 25 Nov 2015 21:45:29 +0000 |
| Subject: | Re: Re: How do I save TSRMLS_CACHE for a new thread in PHP7? | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-13361@lists.php.net to get a copy of this message | ||
On 25/11/15 20:25, Ruslan Osmanov wrote:
I'll try to explain the problem.
I have a function(let's call it execF), which is passed to a
library(libeio) as a callback. This function is invoked afterwards by
the library in separate thread.
The function is calling Zend API, particularly ZVAL_STRINGL(). The
Zend API uses TSRMLS_CACHE internally. For instance, ZVAL_STRINGL()
allocates zend_string which implies using AG() macro. The AG() macro
relies on TSRMLS_CACHE.
Since TSRMLS_CACHE becomes invalid in new thread, the AG() macro (as
well as other macros relying on TSRMLS_CACHE) fails with segmentation
fault.
Why are you allocating a string? Are you expecting to later use it on the php request?
What's the goal of your extension? I suspect you may have an earlier misstep.
Regards