Index: includes/lock.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/lock.inc,v
retrieving revision 1.4
diff -u -p -r1.4 lock.inc
--- includes/lock.inc	6 May 2010 15:20:18 -0000	1.4
+++ includes/lock.inc	20 May 2010 06:10:22 -0000
@@ -194,12 +194,14 @@ function lock_may_be_available($name) {
  *   TRUE if the lock holds, FALSE if it is available.
  */
 function lock_wait($name, $delay = 30) {
-  $delay = (int) $delay;
+  // Multiply delay by ten, since we will poll every 1/10th of a second.
+  $delay = (int) $delay * 10;
   while ($delay--) {
     // This function should only be called by a request that failed to get a
     // lock, so we sleep first to give the parallel request a chance to finish
-    // and release the lock.
-    sleep(1);
+    // and release the lock. Use usleep for 100ms, instead of sleep(1),  so that
+    // processes don't wait around too much longer than necessary.
+    usleep(100000);
     if (lock_may_be_available($name)) {
       // No longer need to wait.
       return FALSE;
