coroutine: Fix setup of sigaltstack coroutines
authorJan Kiszka <jan.kiszka@siemens.com>
Wed, 9 May 2012 17:23:27 +0000 (14:23 -0300)
committerKevin Wolf <kwolf@redhat.com>
Mon, 14 May 2012 15:02:19 +0000 (17:02 +0200)
Use pthread_kill instead of process-wide kill to invoke the signal
handler used for stack switching. This may fix spurious lock-ups with
this backend, easily triggerable by extending the time window between
kill and sigsuspend.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
coroutine-sigaltstack.c

index 7ff2d3379e5dfab4c2f38e1c26d398588fac25dc..b2e316cea2f1aea20efd6275057f79cb4413cff4 100644 (file)
@@ -226,7 +226,7 @@ static Coroutine *coroutine_new(void)
      * called.
      */
     coTS->tr_called = 0;
-    kill(getpid(), SIGUSR2);
+    pthread_kill(pthread_self(), SIGUSR2);
     sigfillset(&sigs);
     sigdelset(&sigs, SIGUSR2);
     while (!coTS->tr_called) {