Hi all.

It seems that zend_ts_hash_clean is not actually thread-safe: it
delegates to zend_hash_clean without first acquiring the write lock on
the hashtable.

Is this behavior an oversight (if so, should I open a bug report with
the trivial patch below?) or is this intentional?

Marco

--- zend_ts_hash.c.orig 2007-04-16 10:27:24.000000000 -0700
+++ zend_ts_hash.c      2007-04-16 10:28:44.000000000 -0700
@@ -90,8 +90,10 @@

ZEND_API void zend_ts_hash_clean(TsHashTable *ht)
{
+       begin_write(ht);
       ht->reader = 0;
       zend_hash_clean(TS_HASH(ht));
+       end_write(ht);
}

ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nK
eyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC
)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to