Whamcloud - gitweb
split osc_cl.c into osc_object.c osc_lock.c osc_io.c osc_page.c osc_dev.c
[fs/lustre-release.git] / libcfs / libcfs / user-lock.c
index 1f392f6..ab4447c 100644 (file)
@@ -147,6 +147,13 @@ void __up(struct semaphore *s)
  * - wait_for_completion(c)
  */
 
+static cfs_wait_handler *wait_handler;
+
+void init_completion_module(cfs_wait_handler *handler)
+{
+        wait_handler = handler;
+}
+
 void init_completion(struct completion *c)
 {
         LASSERT(c != NULL);
@@ -164,11 +171,23 @@ void complete(struct completion *c)
 void wait_for_completion(struct completion *c)
 {
         LASSERT(c != NULL);
+        do {
+                if (wait_handler) 
+                        wait_handler(1000);
+                else
+                        break;
+        } while (c->done == 0);
 }
 
 int wait_for_completion_interruptible(struct completion *c)
 {
         LASSERT(c != NULL);
+        do {
+                if (wait_handler) 
+                        wait_handler(1000);
+                else
+                        break;
+        } while (c->done == 0);
         return 0;
 }