diff options
| author | Antony Dovgal <tony2001@php.net> | 2007-05-11 12:21:26 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2007-05-11 12:21:26 +0000 |
| commit | c8cfd3b99aed9ca4bbcaf4f1221f38969f97965f (patch) | |
| tree | e6be85a6106eca8ae2c51b039107fd1a56ec4785 /Zend | |
| parent | c1e84f1fff49ac7afb98ac00fdf1892558a6f527 (diff) | |
| download | php-git-c8cfd3b99aed9ca4bbcaf4f1221f38969f97965f.tar.gz | |
MFH: fix #41134 (zend_ts_hash_clean not thread-safe)
fix also zend_ts_hash_*destroy()
Diffstat (limited to 'Zend')
| -rw-r--r-- | Zend/zend_ts_hash.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c index d116a67c79..e3739a39c5 100644 --- a/Zend/zend_ts_hash.c +++ b/Zend/zend_ts_hash.c @@ -81,17 +81,22 @@ ZEND_API int _zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHas ZEND_API void zend_ts_hash_destroy(TsHashTable *ht) { + begin_write(ht); + zend_hash_destroy(TS_HASH(ht)); + end_write(ht); + #ifdef ZTS tsrm_mutex_free(ht->mx_reader); tsrm_mutex_free(ht->mx_writer); #endif - zend_hash_destroy(TS_HASH(ht)); } ZEND_API void zend_ts_hash_clean(TsHashTable *ht) { ht->reader = 0; + begin_write(ht); zend_hash_clean(TS_HASH(ht)); + end_write(ht); } ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) @@ -140,11 +145,14 @@ ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint n ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht) { + begin_write(ht); + zend_hash_graceful_destroy(TS_HASH(ht)); + end_write(ht); + #ifdef ZTS tsrm_mutex_free(ht->mx_reader); tsrm_mutex_free(ht->mx_reader); #endif - zend_hash_graceful_destroy(TS_HASH(ht)); } ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC) |
