WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] minios: add wait_event_deadline
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 17 Jan 2008 15:20:21 -0800
Delivery-date: Thu, 17 Jan 2008 15:20:52 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] minios: add wait_event_deadline, Xen patchbot-unstable <=