[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] minios: add wait_event_deadline



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1200580872 0
# Node ID 1101ca828ad92210038ed5cde0d18a71af90c5e9
# Parent  a26aee4a152218ba9855f2766bfe6c3846b03074
minios: add wait_event_deadline

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Signed-off-by: Tim Deegan <tim.deegan@xxxxxxxxxxxxx>
---
 extras/mini-os/include/wait.h |   44 +++++++++++++++++++++---------------------
 1 files changed, 23 insertions(+), 21 deletions(-)

diff -r a26aee4a1522 -r 1101ca828ad9 extras/mini-os/include/wait.h
--- a/extras/mini-os/include/wait.h     Thu Jan 17 14:40:55 2008 +0000
+++ b/extras/mini-os/include/wait.h     Thu Jan 17 14:41:12 2008 +0000
@@ -85,29 +85,31 @@ static inline void wake_up(struct wait_q
     local_irq_restore(flags);   \
 } while (0)
 
-#define wait_event(wq, condition) do{             \
-    unsigned long flags;                          \
-    if(condition)                                 \
-        break;                                    \
-    DEFINE_WAIT(__wait);                          \
-    for(;;)                                       \
-    {                                             \
-        /* protect the list */                    \
-        local_irq_save(flags);                    \
-        add_wait_queue(&wq, &__wait);             \
-        block(current);                           \
-        local_irq_restore(flags);                 \
-        if(condition)                             \
-            break;                                \
-        schedule();                               \
-    }                                             \
-    local_irq_save(flags);                        \
-    /* need to wake up */                         \
-    wake(current);                                \
-    remove_wait_queue(&__wait);                   \
-    local_irq_restore(flags);                     \
+#define wait_event_deadline(wq, condition, deadline) do {       \
+    unsigned long flags;                                        \
+    if(condition)                                               \
+        break;                                                  \
+    DEFINE_WAIT(__wait);                                        \
+    for(;;)                                                     \
+    {                                                           \
+        /* protect the list */                                  \
+        local_irq_save(flags);                                  \
+        add_wait_queue(&wq, &__wait);                           \
+        current->wakeup_time = deadline;                        \
+        clear_runnable(current);                                \
+        local_irq_restore(flags);                               \
+        if((condition) || (deadline && NOW() >= deadline))      \
+            break;                                              \
+        schedule();                                             \
+    }                                                           \
+    local_irq_save(flags);                                      \
+    /* need to wake up */                                       \
+    wake(current);                                              \
+    remove_wait_queue(&__wait);                                 \
+    local_irq_restore(flags);                                   \
 } while(0) 
 
+#define wait_event(wq, condition) wait_event_deadline(wq, condition, 0) 
 
 
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.