[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [COMMIT ee39930] posix-aio-compat: avoid signal race when
From: |
Anthony Liguori |
Subject: |
[Qemu-commits] [COMMIT ee39930] posix-aio-compat: avoid signal race when spawning athread |
Date: |
Sun, 27 Sep 2009 00:17:28 -0000 |
From: malc <address@hidden>
Signed-off-by: malc <address@hidden>
diff --git a/posix-aio-compat.c b/posix-aio-compat.c
index 68cbec8..400d898 100644
--- a/posix-aio-compat.c
+++ b/posix-aio-compat.c
@@ -301,14 +301,9 @@ static size_t handle_aiocb_rw(struct qemu_paiocb *aiocb)
static void *aio_thread(void *unused)
{
pid_t pid;
- sigset_t set;
pid = getpid();
- /* block all signals */
- if (sigfillset(&set)) die("sigfillset");
- if (sigprocmask(SIG_BLOCK, &set, NULL)) die("sigprocmask");
-
while (1) {
struct qemu_paiocb *aiocb;
size_t ret = 0;
@@ -369,9 +364,18 @@ static void *aio_thread(void *unused)
static void spawn_thread(void)
{
+ sigset_t set, oldset;
+
cur_threads++;
idle_threads++;
+
+ /* block all signals */
+ if (sigfillset(&set)) die("sigfillset");
+ if (sigprocmask(SIG_SETMASK, &set, &oldset)) die("sigprocmask");
+
thread_create(&thread_id, &attr, aio_thread, NULL);
+
+ if (sigprocmask(SIG_SETMASK, &oldset, NULL)) die("sigprocmask restore");
}
static void qemu_paio_submit(struct qemu_paiocb *aiocb)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [COMMIT ee39930] posix-aio-compat: avoid signal race when spawning athread,
Anthony Liguori <=