]> git.proxmox.com Git - mirror_qemu.git/blobdiff - util/thread-pool.c
target-i386: fix "info lapic" segfault on isapc
[mirror_qemu.git] / util / thread-pool.c
index 7c9cec57e3fa40b37755914a4912f791f4b9a142..610646d1314ed6f174587805d3674ffdc7535db5 100644 (file)
@@ -185,7 +185,16 @@ restart:
              */
             qemu_bh_schedule(pool->completion_bh);
 
+            aio_context_release(pool->ctx);
             elem->common.cb(elem->common.opaque, elem->ret);
+            aio_context_acquire(pool->ctx);
+
+            /* We can safely cancel the completion_bh here regardless of someone
+             * else having scheduled it meanwhile because we reenter the
+             * completion function anyway (goto restart).
+             */
+            qemu_bh_cancel(pool->completion_bh);
+
             qemu_aio_unref(elem);
             goto restart;
         } else {
@@ -269,7 +278,7 @@ static void thread_pool_co_cb(void *opaque, int ret)
     ThreadPoolCo *co = opaque;
 
     co->ret = ret;
-    qemu_coroutine_enter(co->co);
+    aio_co_wake(co->co);
 }
 
 int coroutine_fn thread_pool_submit_co(ThreadPool *pool, ThreadPoolFunc *func,