logo       

cvs: pecl /apc apc_cache.c: msg#00269

php.pecl.cvs

Subject: cvs: pecl /apc apc_cache.c

rasmus Fri Jul 29 18:48:38 2005 EDT

Modified files:
/pecl/apc apc_cache.c
Log:
This read to write-lock upgrade thing didn't really work


http://cvs.php.net/diff.php/pecl/apc/apc_cache.c?r1=3.91&r2=3.92&ty=u
Index: pecl/apc/apc_cache.c
diff -u pecl/apc/apc_cache.c:3.91 pecl/apc/apc_cache.c:3.92
--- pecl/apc/apc_cache.c:3.91 Fri Jul 29 17:42:07 2005
+++ pecl/apc/apc_cache.c Fri Jul 29 18:48:32 2005
@@ -28,7 +28,7 @@

*/

-/* $Id: apc_cache.c,v 3.91 2005/07/29 21:42:07 rasmus Exp $ */
+/* $Id: apc_cache.c,v 3.92 2005/07/29 22:48:32 rasmus Exp $ */

#include "apc_cache.h"
#include "apc_lock.h"
@@ -468,15 +468,12 @@
{
slot_t** slot;

- RDLOCK(cache);
+ LOCK(cache);

slot = &cache->slots[hash(key) % cache->num_slots];

while (*slot) {
if (key_equals((*slot)->key.data.file, key.data.file)) {
-#if RDLOCK_AVAILABLE
- LOCK(cache); /* Upgrade to a write lock */
-#endif
if ((*slot)->key.mtime < key.mtime) {
remove_slot(cache, slot);
break;
@@ -494,9 +491,6 @@
slot = &(*slot)->next;
}

-#if RDLOCK_AVAILABLE
- LOCK(cache); /* Upgrade to a write lock */
-#endif
cache->header->num_misses++;
UNLOCK(cache);
return NULL;
@@ -508,15 +502,12 @@
{
slot_t** slot;

- RDLOCK(cache);
+ LOCK(cache);

slot = &cache->slots[string_nhash_8(strkey, keylen) % cache->num_slots];

while (*slot) {
if (!strncmp((*slot)->key.data.user.identifier, strkey, keylen)) {
-#if RDLOCK_AVAILABLE
- LOCK(cache); /* Upgrade to a write lock */
-#endif
/* Check to make sure this entry isn't expired by a hard TTL */
if((*slot)->value->data.user.ttl && ((*slot)->creation_time +
(*slot)->value->data.user.ttl) < t) {
remove_slot(cache, slot);
@@ -534,9 +525,6 @@
slot = &(*slot)->next;
}

-#if RDLOCK_AVAILABLE
- LOCK(cache); /* Upgrade to a write lock */
-#endif
cache->header->num_misses++;
UNLOCK(cache);
return NULL;





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise