aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2018-03-05 14:43:22 +0800
committerDaniel P. Berrangé <berrange@redhat.com>2018-03-06 10:19:05 +0000
commita17536c594bfed94d05667b419f747b692f5fc7f (patch)
tree6e623ad270bb97e1eae6685e32d80e110b55247a /include
parent938c8b79e5249d41469151e30268cfaf88bdb588 (diff)
downloadqemu-a17536c594bfed94d05667b419f747b692f5fc7f.zip
qemu-a17536c594bfed94d05667b419f747b692f5fc7f.tar.gz
qemu-a17536c594bfed94d05667b419f747b692f5fc7f.tar.bz2
qio: non-default context for threaded qtask
qio_task_run_in_thread() allows main thread to run blocking operations in the background. However it has an assumption on that it's always working with the default context. This patch tries to allow the threaded QIO task framework to run with non-default gcontext. Currently no functional change so far, so the QIOTasks are still always running on main context. Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/io/task.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/io/task.h b/include/io/task.h
index 6021f51..9e09b95 100644
--- a/include/io/task.h
+++ b/include/io/task.h
@@ -227,15 +227,18 @@ QIOTask *qio_task_new(Object *source,
* @worker: the function to invoke in a thread
* @opaque: opaque data to pass to @worker
* @destroy: function to free @opaque
+ * @context: the context to run the complete hook. If %NULL, the
+ * default context will be used.
*
* Run a task in a background thread. When @worker
* returns it will call qio_task_complete() in
- * the main event thread context.
+ * the event thread context that provided.
*/
void qio_task_run_in_thread(QIOTask *task,
QIOTaskWorker worker,
gpointer opaque,
- GDestroyNotify destroy);
+ GDestroyNotify destroy,
+ GMainContext *context);
/**
* qio_task_complete: