diff options
author | Peter Xu <peterx@redhat.com> | 2019-03-06 19:55:29 +0800 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2019-03-08 10:16:15 +0000 |
commit | b506e0f16c05b68b776752909e4451b54d461fd1 (patch) | |
tree | ce7a80320ae30df2604c1fc3398d0d2b716c5d3b /include | |
parent | 21c4d15b4708b7d30c450041a560df670f36cac8 (diff) |
iothread: create the gcontext unconditionally
In existing code we create the gcontext dynamically at the first
access of the gcontext from caller. That can bring some complexity
and potential races during using iothread. Since the context itself
is not that big a resource, and we won't have millions of iothread,
let's simply create the gcontext unconditionally.
This will also be a preparation work further to move the thread
context push operation earlier than before (now it's only pushed right
before we want to start running the gmainloop).
Removing the g_once since it's not necessary, while introducing a new
run_gcontext boolean to show whether we want to run the gcontext.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-id: 20190306115532.23025-3-peterx@redhat.com
Message-Id: <20190306115532.23025-3-peterx@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sysemu/iothread.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sysemu/iothread.h b/include/sysemu/iothread.h index 50411ba54a..5f6240d5cb 100644 --- a/include/sysemu/iothread.h +++ b/include/sysemu/iothread.h @@ -24,9 +24,9 @@ typedef struct { QemuThread thread; AioContext *ctx; + bool run_gcontext; /* whether we should run gcontext */ GMainContext *worker_context; GMainLoop *main_loop; - GOnce once; QemuSemaphore init_done_sem; /* is thread init done? */ bool stopping; /* has iothread_stop() been called? */ bool running; /* should iothread_run() continue? */ |