qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v5 3/5] coroutine: implement coroutines using gt


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH v5 3/5] coroutine: implement coroutines using gthread
Date: Sat, 25 Jun 2011 19:03:44 +0200

Am 12.06.2011 um 22:46 schrieb Stefan Hajnoczi:

From: "Aneesh Kumar K.V" <address@hidden>

On platforms that don't support makecontext(3) use gthread based
coroutine implementation.

[Original patch by Aneesh, made consistent with coroutine-ucontext.c and
switched to GStaticPrivate by Stefan.  Tested on Linux and OpenBSD.]

Signed-off-by: Aneesh Kumar K.V <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
Makefile.objs       |    4 ++
configure           |   16 ++++++
coroutine-gthread.c | 131 ++++++++++++++++++++++++++++++++++++++++++ +++++++++
3 files changed, 151 insertions(+), 0 deletions(-)
create mode 100644 coroutine-gthread.c

diff --git a/configure b/configure
index 3697eba..df63403 100755
--- a/configure
+++ b/configure
@@ -2552,6 +2552,18 @@ if test "$trace_backend" = "dtrace"; then
fi

##########################################
+# check if we have makecontext
+
+ucontext_coroutine=no
+cat > $TMPC << EOF
+#include <ucontext.h>
+int main(void) { makecontext(0, 0, 0); }
+EOF
+if compile_prog "" "" ; then
+    ucontext_coroutine=yes
+fi
+
+##########################################
# End of CC checks
# After here, no more $cc or $ld runs


This add-on patch inserts a check for Darwin to force ucontext_coroutine=no there (getcontext() returns -1, with errno == ENOTSUP):

diff --git a/configure b/configure
index c28ed7b..854f24a 100755
--- a/configure
+++ b/configure
@@ -2479,12 +2479,14 @@ fi
 # check if we have makecontext

 ucontext_coroutine=no
-cat > $TMPC << EOF
+if test "$darwin" != "yes"; then
+    cat > $TMPC << EOF
 #include <ucontext.h>
 int main(void) { makecontext(0, 0, 0); }
 EOF
-if compile_prog "" "" ; then
-    ucontext_coroutine=yes
+    if compile_prog "" "" ; then
+        ucontext_coroutine=yes
+    fi
 fi

 ##########################################

This fixes Darwin/ppc64 (and ppc) v10.5.
Don't know whether v10.6 / i386 might have a working implementation (cc'ing Alexand{re,er}).

Andreas

@@ -3015,6 +3027,10 @@ if test "$rbd" = "yes" ; then
  echo "CONFIG_RBD=y" >> $config_host_mak
fi

+if test "$ucontext_coroutine" = "yes" ; then
+  echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
+fi
+
# USB host support
case "$usb" in
linux)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]