diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2019-02-11 18:24:28 +0000 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-02-12 17:35:56 +0100 |
commit | dbb44504c28683a4428308f72b9f61733fcda007 (patch) | |
tree | 85f1f1875e150472c9b4ffd75df65a9bb4dcd7f7 /io/trace-events | |
parent | 52d6cfeca29734904ce589c00028347b7fa9cfd9 (diff) |
io: add qio_task_wait_thread to join with a background thread
Add the ability for a caller to wait for completion of the
background thread to synchronously dispatch its result, without
needing to wait for the main loop to run the idle callback.
This method needs very careful usage to avoid a dangerous
race condition with the free'ing of the task. The completion
callback is normally invoked from an idle callback registered
with the main loop context. The qio_task_wait_thread method
must only be called if the completion callback has not yet
run. The only safe way to achieve this is to run the
qio_task_wait_thread method from the thread that executes
the main loop.
It is generally a bad idea to use this method since it will
block execution of the main loop, however, the design of
the character devices and its usage from vhostuser already
requires blocking execution.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20190211182442.8542-3-berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'io/trace-events')
-rw-r--r-- | io/trace-events | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/io/trace-events b/io/trace-events index f70bad7cbe..07a7bbec6a 100644 --- a/io/trace-events +++ b/io/trace-events @@ -7,6 +7,8 @@ qio_task_thread_start(void *task, void *worker, void *opaque) "Task thread start qio_task_thread_run(void *task) "Task thread run task=%p" qio_task_thread_exit(void *task) "Task thread exit task=%p" qio_task_thread_result(void *task) "Task thread result task=%p" +qio_task_thread_source_attach(void *task, void *source) "Task thread source attach task=%p source=%p" +qio_task_thread_source_cancel(void *task, void *source) "Task thread source cancel task=%p source=%p" # io/channel-socket.c qio_channel_socket_new(void *ioc) "Socket new ioc=%p" |