aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Raymond <cerbere@gmail.com>2011-06-15 01:20:31 -0400
committerBlue Swirl <blauwirbel@gmail.com>2011-07-16 19:43:00 +0000
commit89b9ba661bd2d6155308f895ec075d813f0e129b (patch)
treef7ea26ffe7cea8eb7acea9566b7871f7d8a384cb
parent5664aed99a4ab6e661b40e475449a32150f46184 (diff)
Fix signal handling of SIG_IPI when io-thread is enabled
Both the signal thread (via sigwait()) and the cpu thread (via a normal signal handler) were attempting to catch SIG_IPI. This resulted in random freezes under Darwin. This patch separates SIG_IPI from the rest of the signals handled by the signal thread, because it is independently caught by the cpu thread. Signed-off-by: Alexandre Raymond <cerbere@gmail.com> Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r--cpus.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/cpus.c b/cpus.c
index e02576cb66..3035314486 100644
--- a/cpus.c
+++ b/cpus.c
@@ -396,10 +396,18 @@ static int qemu_signal_init(void)
sigaddset(&set, SIGUSR2);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
+ /*
+ * SIG_IPI must be blocked in the main thread and must not be caught
+ * by sigwait() in the signal thread. Otherwise, the cpu thread will
+ * not catch it reliably.
+ */
+ sigemptyset(&set);
+ sigaddset(&set, SIG_IPI);
+ pthread_sigmask(SIG_BLOCK, &set, NULL);
+
sigemptyset(&set);
sigaddset(&set, SIGIO);
sigaddset(&set, SIGALRM);
- sigaddset(&set, SIG_IPI);
sigaddset(&set, SIGBUS);
#else
sigemptyset(&set);