diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2016-08-11 15:20:58 +0100 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2017-01-23 15:32:18 +0000 |
commit | 60e705c51c66373f78e536e0462744a610c27cf6 (patch) | |
tree | a92d50a052c105d1554b11ab4c89a90f15a54be0 /io/task.c | |
parent | 1a447e4f0266d757687b38146795b95525d37d94 (diff) |
io: change the QIOTask callback signature
Currently the QIOTaskFunc signature takes an Object * for
the source, and an Error * for any error. We also need to
be able to provide a result pointer. Rather than continue
to add parameters to QIOTaskFunc, remove the existing
ones and simply pass the QIOTask object instead. This
has methods to access all the other data items required
in the callback impl.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'io/task.c')
-rw-r--r-- | io/task.c | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -87,13 +87,11 @@ static gboolean gio_task_thread_result(gpointer opaque) struct QIOTaskThreadData *data = opaque; trace_qio_task_thread_result(data->task); - if (data->ret == 0) { - qio_task_complete(data->task); - } else { - qio_task_abort(data->task, data->err); + if (data->err) { + qio_task_set_error(data->task, data->err); } + qio_task_complete(data->task); - error_free(data->err); if (data->destroy) { data->destroy(data->opaque); } @@ -149,19 +147,11 @@ void qio_task_run_in_thread(QIOTask *task, void qio_task_complete(QIOTask *task) { - task->func(task->source, NULL, task->opaque); + task->func(task, task->opaque); trace_qio_task_complete(task); qio_task_free(task); } -void qio_task_abort(QIOTask *task, - Error *err) -{ - task->func(task->source, err, task->opaque); - trace_qio_task_abort(task); - qio_task_free(task); -} - void qio_task_set_error(QIOTask *task, Error *err) |