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 /tests/test-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 'tests/test-io-task.c')
-rw-r--r-- | tests/test-io-task.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/test-io-task.c b/tests/test-io-task.c index 024eb585e4..84144c9047 100644 --- a/tests/test-io-task.c +++ b/tests/test-io-task.c @@ -50,14 +50,13 @@ struct TestTaskData { }; -static void task_callback(Object *source, - Error *err, +static void task_callback(QIOTask *task, gpointer opaque) { struct TestTaskData *data = opaque; - data->source = source; - data->err = err; + data->source = qio_task_get_source(task); + qio_task_propagate_error(task, &data->err); } @@ -120,9 +119,9 @@ static void test_task_failure(void) error_setg(&err, "Some error"); - qio_task_abort(task, err); + qio_task_set_error(task, err); + qio_task_complete(task); - error_free(err); object_unref(obj); g_assert(data.source == obj); @@ -158,14 +157,13 @@ static int test_task_thread_worker(QIOTask *task, } -static void test_task_thread_callback(Object *source, - Error *err, +static void test_task_thread_callback(QIOTask *task, gpointer opaque) { struct TestThreadWorkerData *data = opaque; - data->source = source; - data->err = err; + data->source = qio_task_get_source(task); + qio_task_propagate_error(task, &data->err); data->complete = g_thread_self(); |