Index: trunk/xcache.c
===================================================================
--- trunk/xcache.c	(revision 876)
+++ trunk/xcache.c	(revision 881)
@@ -117,7 +117,7 @@
 /* }}} */
 
-/* any function in *_dmz is only safe be called within locked(single thread) area */
-
-static void xc_php_add_dmz(xc_cache_t *cache, xc_entry_data_php_t *php) /* {{{ */
+/* any function in *_unlocked is only safe be called within locked (single thread access) area */
+
+static void xc_php_add_unlocked(xc_cache_t *cache, xc_entry_data_php_t *php) /* {{{ */
 {
 	xc_entry_data_php_t **head = &(cache->phps[php->hvalue]);
@@ -127,5 +127,5 @@
 }
 /* }}} */
-static xc_entry_data_php_t *xc_php_store_dmz(xc_cache_t *cache, xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */
+static xc_entry_data_php_t *xc_php_store_unlocked(xc_cache_t *cache, xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */
 {
 	xc_entry_data_php_t *stored_php;
@@ -135,5 +135,5 @@
 	stored_php = xc_processor_store_xc_entry_data_php_t(cache, php TSRMLS_CC);
 	if (stored_php) {
-		xc_php_add_dmz(cache, stored_php);
+		xc_php_add_unlocked(cache, stored_php);
 		return stored_php;
 	}
@@ -144,5 +144,5 @@
 }
 /* }}} */
-static xc_entry_data_php_t *xc_php_find_dmz(xc_cache_t *cache, xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */
+static xc_entry_data_php_t *xc_php_find_unlocked(xc_cache_t *cache, xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */
 {
 	xc_entry_data_php_t *p;
@@ -156,15 +156,15 @@
 }
 /* }}} */
-static void xc_php_free_dmz(xc_cache_t *cache, xc_entry_data_php_t *php) /* {{{ */
+static void xc_php_free_unlocked(xc_cache_t *cache, xc_entry_data_php_t *php) /* {{{ */
 {
 	cache->mem->handlers->free(cache->mem, (xc_entry_data_php_t *)php);
 }
 /* }}} */
-static void xc_php_addref_dmz(xc_entry_data_php_t *php) /* {{{ */
+static void xc_php_addref_unlocked(xc_entry_data_php_t *php) /* {{{ */
 {
 	php->refcount ++;
 }
 /* }}} */
-static void xc_php_release_dmz(xc_cache_t *cache, xc_entry_data_php_t *php) /* {{{ */
+static void xc_php_release_unlocked(xc_cache_t *cache, xc_entry_data_php_t *php) /* {{{ */
 {
 	if (-- php->refcount == 0) {
@@ -175,5 +175,5 @@
 				/* unlink */
 				*pp = p->next;
-				xc_php_free_dmz(cache, php);
+				xc_php_free_unlocked(cache, php);
 				return;
 			}
@@ -184,5 +184,5 @@
 /* }}} */
 
-static inline int xc_entry_equal_dmz(xc_entry_type_t type, const xc_entry_t *entry1, const xc_entry_t *entry2) /* {{{ */
+static inline int xc_entry_equal_unlocked(xc_entry_type_t type, const xc_entry_t *entry1, const xc_entry_t *entry2) /* {{{ */
 {
 	/* this function isn't required but can be in dmz */
@@ -234,5 +234,5 @@
 }
 /* }}} */
-static inline int xc_entry_has_prefix_dmz(xc_entry_type_t type, xc_entry_t *entry, zval *prefix) /* {{{ */
+static inline int xc_entry_has_prefix_unlocked(xc_entry_type_t type, xc_entry_t *entry, zval *prefix) /* {{{ */
 {
 	/* this function isn't required but can be in dmz */
@@ -261,5 +261,5 @@
 }
 /* }}} */
-static void xc_entry_add_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry) /* {{{ */
+static void xc_entry_add_unlocked(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry) /* {{{ */
 {
 	xc_entry_t **head = &(cache->entries[entryslotid]);
@@ -269,5 +269,5 @@
 }
 /* }}} */
-static xc_entry_t *xc_entry_store_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */
+static xc_entry_t *xc_entry_store_unlocked(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */
 {
 	xc_entry_t *stored_entry;
@@ -280,5 +280,5 @@
 		: (xc_entry_t *) xc_processor_store_xc_entry_var_t(cache, (xc_entry_var_t *) entry TSRMLS_CC);
 	if (stored_entry) {
-		xc_entry_add_dmz(cache, entryslotid, stored_entry);
+		xc_entry_add_unlocked(cache, entryslotid, stored_entry);
 		return stored_entry;
 	}
@@ -289,27 +289,27 @@
 }
 /* }}} */
-static xc_entry_php_t *xc_entry_php_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_php_t *entry_php TSRMLS_DC) /* {{{ */
-{
-	return (xc_entry_php_t *) xc_entry_store_dmz(XC_TYPE_PHP, cache, entryslotid, (xc_entry_t *) entry_php TSRMLS_CC);
-}
-/* }}} */
-static xc_entry_var_t *xc_entry_var_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_var_t *entry_var TSRMLS_DC) /* {{{ */
-{
-	return (xc_entry_var_t *) xc_entry_store_dmz(XC_TYPE_VAR, cache, entryslotid, (xc_entry_t *) entry_var TSRMLS_CC);
-}
-/* }}} */
-static void xc_entry_free_real_dmz(xc_entry_type_t type, xc_cache_t *cache, volatile xc_entry_t *entry) /* {{{ */
+static xc_entry_php_t *xc_entry_php_store_unlocked(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_php_t *entry_php TSRMLS_DC) /* {{{ */
+{
+	return (xc_entry_php_t *) xc_entry_store_unlocked(XC_TYPE_PHP, cache, entryslotid, (xc_entry_t *) entry_php TSRMLS_CC);
+}
+/* }}} */
+static xc_entry_var_t *xc_entry_var_store_unlocked(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_var_t *entry_var TSRMLS_DC) /* {{{ */
+{
+	return (xc_entry_var_t *) xc_entry_store_unlocked(XC_TYPE_VAR, cache, entryslotid, (xc_entry_t *) entry_var TSRMLS_CC);
+}
+/* }}} */
+static void xc_entry_free_real_unlocked(xc_entry_type_t type, xc_cache_t *cache, volatile xc_entry_t *entry) /* {{{ */
 {
 	if (type == XC_TYPE_PHP) {
-		xc_php_release_dmz(cache, ((xc_entry_php_t *) entry)->php);
+		xc_php_release_unlocked(cache, ((xc_entry_php_t *) entry)->php);
 	}
 	cache->mem->handlers->free(cache->mem, (xc_entry_t *)entry);
 }
 /* }}} */
-static void xc_entry_free_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_entry_t *entry TSRMLS_DC) /* {{{ */
+static void xc_entry_free_unlocked(xc_entry_type_t type, xc_cache_t *cache, xc_entry_t *entry TSRMLS_DC) /* {{{ */
 {
 	cache->entries_count --;
 	if ((type == XC_TYPE_PHP ? ((xc_entry_php_t *) entry)->refcount : 0) == 0) {
-		xc_entry_free_real_dmz(type, cache, entry);
+		xc_entry_free_real_unlocked(type, cache, entry);
 	}
 	else {
@@ -322,13 +322,13 @@
 }
 /* }}} */
-static void xc_entry_remove_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */
+static void xc_entry_remove_unlocked(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */
 {
 	xc_entry_t **pp = &(cache->entries[entryslotid]);
 	xc_entry_t *p;
 	for (p = *pp; p; pp = &(p->next), p = p->next) {
-		if (xc_entry_equal_dmz(type, entry, p)) {
+		if (xc_entry_equal_unlocked(type, entry, p)) {
 			/* unlink */
 			*pp = p->next;
-			xc_entry_free_dmz(type, cache, entry TSRMLS_CC);
+			xc_entry_free_unlocked(type, cache, entry TSRMLS_CC);
 			return;
 		}
@@ -337,9 +337,9 @@
 }
 /* }}} */
-static xc_entry_t *xc_entry_find_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */
+static xc_entry_t *xc_entry_find_unlocked(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */
 {
 	xc_entry_t *p;
 	for (p = cache->entries[entryslotid]; p; p = p->next) {
-		if (xc_entry_equal_dmz(type, entry, p)) {
+		if (xc_entry_equal_unlocked(type, entry, p)) {
 			zend_bool fresh;
 			switch (type) {
@@ -368,5 +368,5 @@
 			}
 
-			xc_entry_remove_dmz(type, cache, entryslotid, p TSRMLS_CC);
+			xc_entry_remove_unlocked(type, cache, entryslotid, p TSRMLS_CC);
 			return NULL;
 		}
@@ -375,5 +375,5 @@
 }
 /* }}} */
-static void xc_entry_hold_php_dmz(xc_cache_t *cache, xc_entry_php_t *entry TSRMLS_DC) /* {{{ */
+static void xc_entry_hold_php_unlocked(xc_cache_t *cache, xc_entry_php_t *entry TSRMLS_DC) /* {{{ */
 {
 	TRACE("hold %d:%s", entry->file_inode, entry->entry.name.str.val);
@@ -413,5 +413,5 @@
 }
 /* }}} */
-static void xc_cache_hit_dmz(xc_cache_t *cache TSRMLS_DC) /* {{{ */
+static void xc_cache_hit_unlocked(xc_cache_t *cache TSRMLS_DC) /* {{{ */
 {
 	cache->hits ++;
@@ -434,6 +434,6 @@
 /* helper function that loop through each entry */
 #define XC_ENTRY_APPLY_FUNC(name) zend_bool name(xc_entry_t *entry TSRMLS_DC)
-typedef XC_ENTRY_APPLY_FUNC((*cache_apply_dmz_func_t));
-static void xc_entry_apply_dmz(xc_entry_type_t type, xc_cache_t *cache, cache_apply_dmz_func_t apply_func TSRMLS_DC) /* {{{ */
+typedef XC_ENTRY_APPLY_FUNC((*cache_apply_unlocked_func_t));
+static void xc_entry_apply_unlocked(xc_entry_type_t type, xc_cache_t *cache, cache_apply_dmz_func_t apply_func TSRMLS_DC) /* {{{ */
 {
 	xc_entry_t *p, **pp;
@@ -446,5 +446,5 @@
 				/* unlink */
 				*pp = p->next;
-				xc_entry_free_dmz(type, cache, p TSRMLS_CC);
+				xc_entry_free_unlocked(type, cache, p TSRMLS_CC);
 			}
 			else {
@@ -458,8 +458,8 @@
 #define XC_CACHE_APPLY_FUNC(name) void name(xc_cache_t *cache TSRMLS_DC)
 /* call graph:
- * xc_gc_expires_php -> xc_gc_expires_one -> xc_entry_apply_dmz -> xc_gc_expires_php_entry_dmz
- * xc_gc_expires_var -> xc_gc_expires_one -> xc_entry_apply_dmz -> xc_gc_expires_var_entry_dmz
+ * xc_gc_expires_php -> xc_gc_expires_one -> xc_entry_apply_unlocked -> xc_gc_expires_php_entry_dmz
+ * xc_gc_expires_var -> xc_gc_expires_one -> xc_entry_apply_unlocked -> xc_gc_expires_var_entry_dmz
  */
-static XC_ENTRY_APPLY_FUNC(xc_gc_expires_php_entry_dmz) /* {{{ */
+static XC_ENTRY_APPLY_FUNC(xc_gc_expires_php_entry_unlocked) /* {{{ */
 {
 	TRACE("ttl %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) entry->atime, xc_php_ttl);
@@ -470,5 +470,5 @@
 }
 /* }}} */
-static XC_ENTRY_APPLY_FUNC(xc_gc_expires_var_entry_dmz) /* {{{ */
+static XC_ENTRY_APPLY_FUNC(xc_gc_expires_var_entry_unlocked) /* {{{ */
 {
 	if (VAR_ENTRY_EXPIRED(entry)) {
@@ -478,5 +478,5 @@
 }
 /* }}} */
-static void xc_gc_expires_one(xc_entry_type_t type, xc_cache_t *cache, zend_ulong gc_interval, cache_apply_dmz_func_t apply_func TSRMLS_DC) /* {{{ */
+static void xc_gc_expires_one(xc_entry_type_t type, xc_cache_t *cache, zend_ulong gc_interval, cache_apply_unlocked_func_t apply_func TSRMLS_DC) /* {{{ */
 {
 	TRACE("interval %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) cache->last_gc_expires, gc_interval);
@@ -485,5 +485,5 @@
 			if (XG(request_time) - cache->last_gc_expires >= gc_interval) {
 				cache->last_gc_expires = XG(request_time);
-				xc_entry_apply_dmz(type, cache, apply_func TSRMLS_CC);
+				xc_entry_apply_unlocked(type, cache, apply_func TSRMLS_CC);
 			}
 		} LEAVE_LOCK(cache);
@@ -500,5 +500,5 @@
 
 	for (i = 0, c = xc_php_hcache.size; i < c; i ++) {
-		xc_gc_expires_one(XC_TYPE_PHP, xc_php_caches[i], xc_php_gc_interval, xc_gc_expires_php_entry_dmz TSRMLS_CC);
+		xc_gc_expires_one(XC_TYPE_PHP, xc_php_caches[i], xc_php_gc_interval, xc_gc_expires_php_entry_unlocked TSRMLS_CC);
 	}
 }
@@ -513,10 +513,10 @@
 
 	for (i = 0, c = xc_var_hcache.size; i < c; i ++) {
-		xc_gc_expires_one(XC_TYPE_VAR, xc_var_caches[i], xc_var_gc_interval, xc_gc_expires_var_entry_dmz TSRMLS_CC);
-	}
-}
-/* }}} */
-
-static XC_CACHE_APPLY_FUNC(xc_gc_delete_dmz) /* {{{ */
+		xc_gc_expires_one(XC_TYPE_VAR, xc_var_caches[i], xc_var_gc_interval, xc_gc_expires_var_entry_unlocked TSRMLS_CC);
+	}
+}
+/* }}} */
+
+static XC_CACHE_APPLY_FUNC(xc_gc_delete_unlocked) /* {{{ */
 {
 	xc_entry_t *p, **pp;
@@ -533,5 +533,5 @@
 			*pp = p->next;
 			cache->deletes_count --;
-			xc_entry_free_real_dmz(XC_TYPE_PHP, cache, p);
+			xc_entry_free_real_unlocked(XC_TYPE_PHP, cache, p);
 		}
 		else {
@@ -547,5 +547,5 @@
 			if (cache->deletes && XG(request_time) - cache->last_gc_deletes > xc_deletes_gc_interval) {
 				cache->last_gc_deletes = XG(request_time);
-				xc_gc_delete_dmz(cache TSRMLS_CC);
+				xc_gc_delete_unlocked(cache TSRMLS_CC);
 			}
 		} LEAVE_LOCK(cache);
@@ -572,5 +572,5 @@
 
 /* helper functions for user functions */
-static void xc_fillinfo_dmz(int cachetype, xc_cache_t *cache, zval *return_value TSRMLS_DC) /* {{{ */
+static void xc_fillinfo_unlocked(int cachetype, xc_cache_t *cache, zval *return_value TSRMLS_DC) /* {{{ */
 {
 	zval *blocks, *hits;
@@ -647,5 +647,5 @@
 }
 /* }}} */
-static void xc_fillentry_dmz(xc_entry_type_t type, const xc_entry_t *entry, xc_hash_value_t entryslotid, int del, zval *list TSRMLS_DC) /* {{{ */
+static void xc_fillentry_unlocked(xc_entry_type_t type, const xc_entry_t *entry, xc_hash_value_t entryslotid, int del, zval *list TSRMLS_DC) /* {{{ */
 {
 	zval* ei;
@@ -717,5 +717,5 @@
 }
 /* }}} */
-static void xc_filllist_dmz(xc_entry_type_t type, xc_cache_t *cache, zval *return_value TSRMLS_DC) /* {{{ */
+static void xc_filllist_unlocked(xc_entry_type_t type, xc_cache_t *cache, zval *return_value TSRMLS_DC) /* {{{ */
 {
 	zval* list;
@@ -728,5 +728,5 @@
 	for (i = 0, c = cache->hentry->size; i < c; i ++) {
 		for (e = cache->entries[i]; e; e = e->next) {
-			xc_fillentry_dmz(type, e, i, 0, list TSRMLS_CC);
+			xc_fillentry_unlocked(type, e, i, 0, list TSRMLS_CC);
 		}
 	}
@@ -736,5 +736,5 @@
 	array_init(list);
 	for (e = cache->deletes; e; e = e->next) {
-		xc_fillentry_dmz(XC_TYPE_PHP, e, 0, 1, list TSRMLS_CC);
+		xc_fillentry_unlocked(XC_TYPE_PHP, e, 0, 1, list TSRMLS_CC);
 	}
 	add_assoc_zval(return_value, "deleted_list", list);
@@ -990,5 +990,5 @@
 } xc_entry_find_include_path_data_t;
 /* }}} */
-static XC_INCLUDE_PATH_XSTAT_FUNC(xc_entry_find_include_path_func_dmz) /* {{{ */
+static XC_INCLUDE_PATH_XSTAT_FUNC(xc_entry_find_include_path_func_unlocked) /* {{{ */
 {
 	xc_entry_find_include_path_data_t *entry_find_include_path_data = (xc_entry_find_include_path_data_t *) data;
@@ -998,5 +998,5 @@
 	compiler->new_entry.entry.name.str.len = strlen(compiler->new_entry.entry.name.str.val);
 
-	*entry_find_include_path_data->stored_entry = (xc_entry_php_t *) xc_entry_find_dmz(
+	*entry_find_include_path_data->stored_entry = (xc_entry_php_t *) xc_entry_find_unlocked(
 			XC_TYPE_PHP
 			, xc_php_caches[compiler->entry_hash.cacheid]
@@ -1008,5 +1008,5 @@
 }
 /* }}} */
-static int xc_entry_find_include_path_dmz(xc_compiler_t *compiler, const char *filepath, xc_entry_php_t **stored_entry TSRMLS_DC) /* {{{ */
+static int xc_entry_find_include_path_unlocked(xc_compiler_t *compiler, const char *filepath, xc_entry_php_t **stored_entry TSRMLS_DC) /* {{{ */
 {
 	char path_buffer[MAXPATHLEN];
@@ -1015,5 +1015,5 @@
 	entry_find_include_path_data.stored_entry = stored_entry;
 
-	return xc_include_path_apply(filepath, path_buffer, xc_entry_find_include_path_func_dmz, (void *) &entry_find_include_path_data TSRMLS_DC)
+	return xc_include_path_apply(filepath, path_buffer, xc_entry_find_include_path_func_unlocked, (void *) &entry_find_include_path_data TSRMLS_DC)
 		? SUCCESS
 		: FAILURE;
@@ -1903,5 +1903,5 @@
 
 	ENTER_LOCK_EX(cache) {
-		if (!compiler->opened_path && xc_entry_find_include_path_dmz(compiler, compiler->filename, &stored_entry TSRMLS_CC) == SUCCESS) {
+		if (!compiler->opened_path && xc_entry_find_include_path_unlocked(compiler, compiler->filename, &stored_entry TSRMLS_CC) == SUCCESS) {
 			compiler->opened_path = compiler->new_entry.entry.name.str.val;
 		}
@@ -1916,12 +1916,12 @@
 			compiler->new_entry.entry.name.str.len = strlen(compiler->new_entry.entry.name.str.val);
 
-			stored_entry = (xc_entry_php_t *) xc_entry_find_dmz(XC_TYPE_PHP, cache, compiler->entry_hash.entryslotid, (xc_entry_t *) &compiler->new_entry TSRMLS_CC);
+			stored_entry = (xc_entry_php_t *) xc_entry_find_unlocked(XC_TYPE_PHP, cache, compiler->entry_hash.entryslotid, (xc_entry_t *) &compiler->new_entry TSRMLS_CC);
 		}
 
 		if (stored_entry) {
-			xc_cache_hit_dmz(cache TSRMLS_CC);
+			xc_cache_hit_unlocked(cache TSRMLS_CC);
 
 			TRACE(" hit %d:%s, holding", compiler->new_entry.file_inode, stored_entry->entry.name.str.val);
-			xc_entry_hold_php_dmz(cache, stored_entry TSRMLS_CC);
+			xc_entry_hold_php_unlocked(cache, stored_entry TSRMLS_CC);
 			stored_php = stored_entry->php;
 			break;
@@ -1936,13 +1936,13 @@
 		}
 
-		stored_php = xc_php_find_dmz(cache, &compiler->new_php TSRMLS_CC);
+		stored_php = xc_php_find_unlocked(cache, &compiler->new_php TSRMLS_CC);
 
 		if (stored_php) {
 			compiler->new_entry.php = stored_php;
-			xc_php_addref_dmz(stored_php);
+			xc_php_addref_unlocked(stored_php);
 			xc_entry_php_init(&compiler->new_entry, compiler->opened_path TSRMLS_CC);
-			stored_entry = xc_entry_php_store_dmz(cache, compiler->entry_hash.entryslotid, &compiler->new_entry TSRMLS_CC);
+			stored_entry = xc_entry_php_store_unlocked(cache, compiler->entry_hash.entryslotid, &compiler->new_entry TSRMLS_CC);
 			TRACE(" cached %d:%s, holding", compiler->new_entry.file_inode, stored_entry->entry.name.str.val);
-			xc_entry_hold_php_dmz(cache, stored_entry TSRMLS_CC);
+			xc_entry_hold_php_unlocked(cache, stored_entry TSRMLS_CC);
 			break;
 		}
@@ -2015,5 +2015,5 @@
 	ENTER_LOCK_EX(cache) { /* {{{ php_store/entry_store */
 		/* php_store */
-		stored_php = xc_php_store_dmz(cache, &compiler->new_php TSRMLS_CC);
+		stored_php = xc_php_store_unlocked(cache, &compiler->new_php TSRMLS_CC);
 		if (!stored_php) {
 			/* error */
@@ -2022,8 +2022,8 @@
 		/* entry_store */
 		compiler->new_entry.php = stored_php;
-		xc_php_addref_dmz(stored_php);
-		stored_entry = xc_entry_php_store_dmz(cache, compiler->entry_hash.entryslotid, &compiler->new_entry TSRMLS_CC);
+		xc_php_addref_unlocked(stored_php);
+		stored_entry = xc_entry_php_store_unlocked(cache, compiler->entry_hash.entryslotid, &compiler->new_entry TSRMLS_CC);
 		if (!stored_entry) {
-			xc_php_release_dmz(cache, stored_php);
+			xc_php_release_unlocked(cache, stored_php);
 		}
 	} LEAVE_LOCK_EX(cache);
@@ -2672,8 +2672,8 @@
 			ENTER_LOCK(cache) {
 				if (optype == XC_OP_INFO) {
-					xc_fillinfo_dmz(type, cache, return_value TSRMLS_CC);
+					xc_fillinfo_unlocked(type, cache, return_value TSRMLS_CC);
 				}
 				else {
-					xc_filllist_dmz(type, cache, return_value TSRMLS_CC);
+					xc_filllist_unlocked(type, cache, return_value TSRMLS_CC);
 				}
 			} LEAVE_LOCK(cache);
@@ -2694,5 +2694,5 @@
 						for (e = cache->entries[entryslotid]; e; e = next) {
 							next = e->next;
-							xc_entry_remove_dmz(type, cache, entryslotid, e TSRMLS_CC);
+							xc_entry_remove_unlocked(type, cache, entryslotid, e TSRMLS_CC);
 						}
 						cache->entries[entryslotid] = NULL;
@@ -2792,9 +2792,9 @@
 
 	ENTER_LOCK(cache) {
-		stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
+		stored_entry_var = (xc_entry_var_t *) xc_entry_find_unlocked(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
 		if (stored_entry_var) {
 			/* return */
 			xc_processor_restore_zval(return_value, stored_entry_var->value, stored_entry_var->have_references TSRMLS_CC);
-			xc_cache_hit_dmz(cache TSRMLS_CC);
+			xc_cache_hit_unlocked(cache TSRMLS_CC);
 		}
 		else {
@@ -2834,10 +2834,10 @@
 
 	ENTER_LOCK(cache) {
-		stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
+		stored_entry_var = (xc_entry_var_t *) xc_entry_find_unlocked(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
 		if (stored_entry_var) {
-			xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC);
+			xc_entry_remove_unlocked(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC);
 		}
 		entry_var.value = value;
-		RETVAL_BOOL(xc_entry_var_store_dmz(cache, entry_hash.entryslotid, &entry_var TSRMLS_CC) != NULL ? 1 : 0);
+		RETVAL_BOOL(xc_entry_var_store_unlocked(cache, entry_hash.entryslotid, &entry_var TSRMLS_CC) != NULL ? 1 : 0);
 	} LEAVE_LOCK(cache);
 }
@@ -2864,7 +2864,7 @@
 
 	ENTER_LOCK(cache) {
-		stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
+		stored_entry_var = (xc_entry_var_t *) xc_entry_find_unlocked(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
 		if (stored_entry_var) {
-			xc_cache_hit_dmz(cache TSRMLS_CC);
+			xc_cache_hit_unlocked(cache TSRMLS_CC);
 			RETVAL_TRUE;
 			/* return */
@@ -2898,7 +2898,7 @@
 
 	ENTER_LOCK(cache) {
-		stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
+		stored_entry_var = (xc_entry_var_t *) xc_entry_find_unlocked(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
 		if (stored_entry_var) {
-			xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC);
+			xc_entry_remove_unlocked(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC);
 			RETVAL_TRUE;
 		}
@@ -2933,6 +2933,6 @@
 				for (entry = cache->entries[entryslotid]; entry; entry = next) {
 					next = entry->next;
-					if (xc_entry_has_prefix_dmz(XC_TYPE_VAR, entry, prefix)) {
-						xc_entry_remove_dmz(XC_TYPE_VAR, cache, entryslotid, entry TSRMLS_CC);
+					if (xc_entry_has_prefix_unlocked(XC_TYPE_VAR, entry, prefix)) {
+						xc_entry_remove_unlocked(XC_TYPE_VAR, cache, entryslotid, entry TSRMLS_CC);
 					}
 				}
@@ -2971,5 +2971,5 @@
 
 	ENTER_LOCK(cache) {
-		stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
+		stored_entry_var = (xc_entry_var_t *) xc_entry_find_unlocked(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
 		if (stored_entry_var) {
 			TRACE("incdec: got entry_var %s", entry_var.entry.name.str.val);
@@ -3007,7 +3007,7 @@
 			entry_var.entry.ctime = stored_entry_var->entry.ctime;
 			entry_var.entry.hits  = stored_entry_var->entry.hits;
-			xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC);
-		}
-		xc_entry_var_store_dmz(cache, entry_hash.entryslotid, &entry_var TSRMLS_CC);
+			xc_entry_remove_unlocked(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC);
+		}
+		xc_entry_var_store_unlocked(cache, entry_hash.entryslotid, &entry_var TSRMLS_CC);
 	} LEAVE_LOCK(cache);
 }
