Hello,

I'm in ZTS mode. Building with VC++ 5, on win 98 with PHP 4.0.5 and apache
1.3.19.

Do you have any clue for this problem ? Thank you in advance cause I'm
stucked.

Gilles

----- Message d'origine -----
De : "Zeev Suraski" <[EMAIL PROTECTED]>
À : "Gilles Koffmann" <[EMAIL PROTECTED]>
Cc : <[EMAIL PROTECTED]>
Envoyé : samedi 23 juin 2001 10:30
Objet : Re: [PHP-DEV] Problem with globals ZTS


> Are you building it in ZTS mode or does it crash in non ZTS mode after
this
> change?
>
> At 09:35 22/6/2001, Gilles Koffmann wrote:
> >Hi,
> >
> >I'm writing an extension to php. After changing my code to have thread
safe
> >globals ,
> >my extension is crashing and I can't figure out what it is:
> >
> >typedef struct {
> >  HashTable array_dl_handle; /* hash user dll name -> handle, getobject,
> >getcompiler, destroyobject */
> >  HashTable array_compiler;  /* hash compiler name -> handle, gps, gms,
> >version */
> >} php_delphi_globals;
> >
> >#ifdef ZTS
> >#define DG(v) (delphi_globals->v)
> >#define DG_FETCH() php_delphi_globals *delphi_globals =
> >ts_resource(delphi_globals_id)
> >#define DG_D       php_delphi_globals *delphi_globals
> >#define DG_DC      , DG_D
> >#define DG_C       delphi_globals
> >#define DG_CC      , DG_C
> >int delphi_globals_id;
> >#else
> >#define DG(v) (delphi_globals.v)
> >#define DG_FETCH()
> >#define DG_D
> >#define DG_DC
> >#define DG_C
> >#define DG_CC
> >php_delphi_globals delphi_globals;
> >#endif
> >
> >#ifdef ZTS
> >static void alloc_delphi_globals_ctor(php_delphi_globals *delphi_globals)
{
> >   memset(delphi_globals, 0, sizeof(php_delphi_globals));
> >}
> >#endif
> >
> >ZEND_MINIT_FUNCTION(delphi) {
> >#ifdef ZTS
> >   delphi_globals_id = ts_allocate_id(sizeof(php_delphi_globals),
> >     (ts_allocate_ctor)alloc_delphi_globals_ctor, NULL);
> >#endif
> >...
> >
> >  DG_FETCH();
> >  zend_hash_init(&DG(array_dl_handle), 0, NULL, NULL, 0);
> >  zend_hash_init(&DG(array_compiler), 0, NULL, NULL, 0);
> >....
> >}
> >
> >It crashes when I do in one function:
> >
> >DG_FETCH();
> >zend_hash_find(&DG(array_dl_handle), module_name,strlen(module_name)+1,
> >(void **)&value);
> >
> >My hashtable is empty.
> >When array_dl_handle was not part of ZTS globals, everything was OK. Any
> >clue ?
> >
> >Gilles.
> >
> >
> >
> >
> >--
> >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]
>
> --
> 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