cvs: ZendEngine2 / zend_ts_hash.c zend_ts_hash.h

From: Date: Thu, 30 Jan 2003 03:15:52 +0000
Subject: cvs: ZendEngine2 / zend_ts_hash.c zend_ts_hash.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-858@lists.php.net to get a copy of this message
phanto Wed Jan 29 22:15:52 2003 EDT Modified files: /ZendEngine2 zend_ts_hash.c zend_ts_hash.h Log: fix non-zts build for wez Index: ZendEngine2/zend_ts_hash.c diff -u ZendEngine2/zend_ts_hash.c:1.6 ZendEngine2/zend_ts_hash.c:1.7 --- ZendEngine2/zend_ts_hash.c:1.6 Sat Jan 11 06:34:43 2003 +++ ZendEngine2/zend_ts_hash.c Wed Jan 29 22:15:51 2003 @@ -16,60 +16,73 @@ +----------------------------------------------------------------------+ */ -#ifdef ZTS #include "zend_ts_hash.h" /* ts management functions */ static void begin_read(TsHashTable *ht) { +#ifdef ZTS tsrm_mutex_lock(ht->mx_reader); if ((++(ht->reader)) == 1) { tsrm_mutex_lock(ht->mx_writer); } tsrm_mutex_unlock(ht->mx_reader); +#endif } static void end_read(TsHashTable *ht) { +#ifdef ZTS tsrm_mutex_lock(ht->mx_reader); if ((--(ht->reader)) == 0) { tsrm_mutex_unlock(ht->mx_writer); } tsrm_mutex_unlock(ht->mx_reader); +#endif } static void begin_write(TsHashTable *ht) { +#ifdef ZTS tsrm_mutex_lock(ht->mx_writer); +#endif } static void end_write(TsHashTable *ht) { +#ifdef ZTS tsrm_mutex_unlock(ht->mx_writer); +#endif } /* delegates */ ZEND_API int zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent) { +#ifdef ZTS ht->mx_reader = tsrm_mutex_alloc(); ht->mx_writer = tsrm_mutex_alloc(); ht->reader = 0; +#endif return zend_hash_init(TS_HASH(ht), nSize, pHashFunction, pDestructor, persistent); } ZEND_API int zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection) { +#ifdef ZTS ht->mx_reader = tsrm_mutex_alloc(); ht->mx_writer = tsrm_mutex_alloc(); ht->reader = 0; +#endif return zend_hash_init_ex(TS_HASH(ht), nSize, pHashFunction, pDestructor, persistent, bApplyProtection); } ZEND_API void zend_ts_hash_destroy(TsHashTable *ht) { +#ifdef ZTS tsrm_mutex_free(ht->mx_reader); tsrm_mutex_free(ht->mx_writer); +#endif zend_hash_destroy(TS_HASH(ht)); } @@ -125,8 +138,10 @@ ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht) { +#ifdef ZTS tsrm_mutex_free(ht->mx_reader); tsrm_mutex_free(ht->mx_reader); +#endif zend_hash_graceful_destroy(TS_HASH(ht)); } @@ -338,5 +353,3 @@ end_read(ht); } #endif - -#endif /* ZTS */ Index: ZendEngine2/zend_ts_hash.h diff -u ZendEngine2/zend_ts_hash.h:1.5 ZendEngine2/zend_ts_hash.h:1.6 --- ZendEngine2/zend_ts_hash.h:1.5 Tue Dec 31 10:54:08 2002 +++ ZendEngine2/zend_ts_hash.h Wed Jan 29 22:15:52 2003 @@ -19,15 +19,15 @@ #ifndef ZEND_TS_HASH_H #define ZEND_TS_HASH_H -#ifdef ZTS - #include "zend.h" typedef struct _zend_ts_hashtable { HashTable hash; zend_uint reader; +#ifdef ZTS MUTEX_T mx_reader; MUTEX_T mx_writer; +#endif } TsHashTable; BEGIN_EXTERN_C() @@ -114,8 +114,5 @@ #define ZEND_TS_INIT_SYMTABLE_EX(ht, n, persistent) \ zend_ts_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent) - - -#endif /* ZTS */ #endif /* ZEND_HASH_H */

« previous php.zend-engine.cvs (#858) next »