]> granicus.if.org Git - php/commitdiff
fix non-zts build for wez
authorHarald Radi <phanto@php.net>
Thu, 30 Jan 2003 03:15:52 +0000 (03:15 +0000)
committerHarald Radi <phanto@php.net>
Thu, 30 Jan 2003 03:15:52 +0000 (03:15 +0000)
Zend/zend_ts_hash.c
Zend/zend_ts_hash.h

index 4bf7527aa7bc89dba1632b289e7060726da64b31..78bb324aec4bf80bbf641672c06d296e1fd69f82 100644 (file)
    +----------------------------------------------------------------------+
 */
 
-#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 int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint n
 
 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 @@ void zend_ts_hash_display(TsHashTable *ht)
        end_read(ht);
 }
 #endif
-
-#endif /* ZTS */
index 2b1b3fc801a610627b3e8a8d59a005df875a955d..39b71ddadbb4fcd2527cde1740a9f5d517afb46a 100644 (file)
 #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()
@@ -115,7 +115,4 @@ END_EXTERN_C()
 #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 */