aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/test.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibaut@ens-lyon.org>2013-01-09 08:43:53 +0000
committerSamuel Thibault <samuel.thibaut@ens-lyon.org>2013-01-09 08:43:53 +0000
commit4813ceb154c194395dda8c6817e1f06c000470d2 (patch)
tree9dc921acbd3ffcba03cc929d8f41e251efec0879 /extras/mini-os/test.c
parentcc4707100aad115c0f384f576c020c6255e77ffb (diff)
downloadxen-4813ceb154c194395dda8c6817e1f06c000470d2.tar.gz
xen-4813ceb154c194395dda8c6817e1f06c000470d2.tar.bz2
xen-4813ceb154c194395dda8c6817e1f06c000470d2.zip
mini-os: Notify shutdown through weak function call instead of wake queue
To allow for more flexibility, this notifies domain shutdown through a function rather than a wake queue, to let the application use a wake queue only if it wishes. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Committed-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'extras/mini-os/test.c')
-rw-r--r--extras/mini-os/test.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/extras/mini-os/test.c b/extras/mini-os/test.c
index 95e2d697f8..0f348d2aac 100644
--- a/extras/mini-os/test.c
+++ b/extras/mini-os/test.c
@@ -45,6 +45,10 @@
#include <xen/features.h>
#include <xen/version.h>
+static unsigned int do_shutdown = 0;
+static unsigned int shutdown_reason;
+static DECLARE_WAIT_QUEUE_HEAD(shutdown_queue);
+
static struct netfront_dev *net_dev;
static struct semaphore net_sem = __SEMAPHORE_INITIALIZER(net_sem, 0);
@@ -487,6 +491,15 @@ void shutdown_frontends(void)
#endif
}
+void app_shutdown(unsigned reason)
+{
+ shutdown_reason = reason;
+ wmb();
+ do_shutdown = 1;
+ wmb();
+ wake_up(&shutdown_queue);
+}
+
static void shutdown_thread(void *p)
{
DEFINE_WAIT(w);