You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/03/22 01:58:15 UTC

[lucy-commits] svn commit: r1084044 - /incubator/lucy/trunk/core/Lucy/Store/Lock.c

Author: marvin
Date: Tue Mar 22 00:58:15 2011
New Revision: 1084044

URL: http://svn.apache.org/viewvc?rev=1084044&view=rev
Log:
Fix bad counting mechanism in Lock which was preventing it from retrying as
often as it should.

Modified:
    incubator/lucy/trunk/core/Lucy/Store/Lock.c

Modified: incubator/lucy/trunk/core/Lucy/Store/Lock.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/Lock.c?rev=1084044&r1=1084043&r2=1084044&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/Lock.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/Lock.c Tue Mar 22 00:58:15 2011
@@ -88,14 +88,12 @@ Lock_get_host(Lock *self)     { return s
 bool_t
 Lock_obtain(Lock *self)
 {
-    float sleep_count = self->interval == 0 
-                      ? 0.0f
-                      : (float)self->timeout / self->interval;
+    int32_t time_left = self->interval == 0 ? 0 : self->timeout;
     bool_t locked = Lock_Request(self);
     
     while (!locked) {
-        sleep_count -= self->interval;
-        if (sleep_count < 0) { break; }
+        time_left -= self->interval;
+        if (time_left <= 0) { break; }
         Sleep_millisleep(self->interval);
         locked = Lock_Request(self);
     }