<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1572,7 +1572,7 @@ int do_store_item(item *it, int comm, conn *c) {
         }
         else if(it-&gt;cas_id == old_it-&gt;cas_id) {
           // cas validates
-          do_item_replace(old_it, it);
+          item_replace(old_it, it);
           stored = 1;
         } else {
           if(settings.verbose &gt; 1) {
@@ -1634,7 +1634,7 @@ int do_store_item(item *it, int comm, conn *c) {
                 old_it = do_item_get_nocheck(key, it-&gt;nkey);
 
             if (old_it != NULL)
-                do_item_replace(old_it, it);
+                item_replace(old_it, it);
             else
                 do_item_link(it);
 
@@ -2281,7 +2281,7 @@ char *do_add_delta(item *it, const bool incr, const int64_t delta, char *buf) {
         }
         memcpy(ITEM_data(new_it), buf, res);
         memcpy(ITEM_data(new_it) + res, &quot;\r\n&quot;, 3);
-        do_item_replace(it, new_it);
+        item_replace(it, new_it);
         do_item_remove(new_it);       /* release our reference */
     } else { /* replace in-place */
         memcpy(ITEM_data(it), buf, res);</diff>
      <filename>memcached.c</filename>
    </modified>
    <modified>
      <diff>@@ -451,14 +451,11 @@ void item_remove(item *item) {
 
 /*
  * Replaces one item with another in the hashtable.
+ * Unprotected by a mutex lock since the core server does not require 
+ * it to be thread-safe.
  */
-int item_replace(item *old, item *new) {
-    int ret;
-
-    pthread_mutex_lock(&amp;cache_lock);
-    ret = do_item_replace(old, new);
-    pthread_mutex_unlock(&amp;cache_lock);
-    return ret;
+int item_replace(item *old_it, item *new_it) {
+    return do_item_replace(old_it, new_it);
 }
 
 /*</diff>
      <filename>thread.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1b7a8118d256b725bc7b5f9a1e888818e483e454</id>
    </parent>
  </parents>
  <author>
    <name>Toru Maesaka</name>
    <email>dev@torum.net</email>
  </author>
  <url>http://github.com/tmaesaka/memcached/commit/ea07c63705b073155c52894941a3df59f60a0268</url>
  <id>ea07c63705b073155c52894941a3df59f60a0268</id>
  <committed-date>2008-05-09T00:28:52-07:00</committed-date>
  <authored-date>2008-05-09T00:28:52-07:00</authored-date>
  <message>The core server never called the mutex wrapper for do_item_replace()
so &quot;item_replace()&quot; was altered to directly call do_item_replace().

This makes things slightly easier to understand when supporting
multiple engines later on since we don't have to worry about
deadlocks occuring in item_replace().</message>
  <tree>c1e532664366b9b8e667d5087ee236931cad847c</tree>
  <committer>
    <name>Toru Maesaka</name>
    <email>dev@torum.net</email>
  </committer>
</commit>
