Segfault problem with --enable-maintainer-zts
| From: | Cesar D. Rodas | Date: | Sun, 05 Apr 2009 07:51:51 +0000 |
| Subject: | Segfault problem with --enable-maintainer-zts | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-6293@lists.php.net to get a copy of this message | ||
Hello,
I am writing an open source extension
(http://github.com/crodas/phplibtextcat/tree/master). Now I want to
add a function that used global variables to set default values, but
when I compile it with thread safe enable, it crashed, this is what I
do:
In php_textcat.h:
#ifdef ZTS
#include "TSRM.h"
#endif
ZEND_BEGIN_MODULE_GLOBALS(textcat)
int ngram_limit;
int threshold;
int max_results;
ZEND_END_MODULE_GLOBALS(textcat)
ZEND_EXTERN_MODULE_GLOBALS(textcat)
#ifdef ZTS
#define TCG(v) TSRMG(textcat_globals_id, zend_textcat_globals *, v)
#else
#define TCG(v) (textcat_globals.v)
#endif
In the php_texcat.c
ZEND_DECLARE_MODULE_GLOBALS(textcat)
PHP_FUNCTION(foobar) {
/* here it crash */
TCG(ngram_limit) = 1;
}
Probably I am missing something, I read the documentation, I've seen
on extension that does that, as the soap, but still I cannot figure
out what I am missing.
Best regards
--
Cesar D. Rodas
http://cesar.la/
Phone: +595-961-974165
Bob Hope - "You know you are getting old when the candles cost more
than the cake."