diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2020-11-16 16:56:14 +0100 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2021-01-19 22:37:28 +0100 |
commit | ed23f8b97128fbd26faec1bff3da35d64afa305b (patch) | |
tree | 30aca4608676329d05d2ba8133996f9149ec7ba0 /gck/gck-session.c | |
parent | f1f1a85026f04f32a53269c104b72f187f1c5b47 (diff) | |
download | gcr-ed23f8b97128fbd26faec1bff3da35d64afa305b.tar.gz |
gck-call: Simplify the code by using GTask based implementation
GckCall uses its own implementation of threads pool to handle the async
calls, now that we've GTask this code can be simplified by reusing
GLib code.
I didn't want to change the API in this commit, even if private not to
mix changes together, so the functions still are used as they used to be
The main difference is that the async_pre and async_ready prepare a
GTask instance, while the async_go starts a thread using the gtask
function.
Callback functions needed to be adapted to the new GAsyncResult type.
Tests needed also some tuning as the underneath task holding a reference
to the source object might be finalized at later stage, when the
thread-related data is removed, as per this we may wait a bit to check
whether a source object gets finalized, this is due to GNOME/GLib#1346.
Diffstat (limited to 'gck/gck-session.c')
-rw-r--r-- | gck/gck-session.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gck/gck-session.c b/gck/gck-session.c index c776005..c9aecdf 100644 --- a/gck/gck-session.c +++ b/gck/gck-session.c @@ -518,7 +518,7 @@ gck_session_initable_init_finish (GAsyncInitable *initable, OpenSession *args; if (_gck_call_basic_finish (result, error)) { - args = _gck_call_arguments (result, OpenSession); + args = _gck_call_async_result_arguments (result, OpenSession); self->pv->handle = args->session; ret = TRUE; } @@ -1467,7 +1467,7 @@ gck_session_create_object_finish (GckSession *self, GAsyncResult *result, GError { CreateObject *args; - args = _gck_call_arguments (result, CreateObject); + args = _gck_call_async_result_arguments (result, CreateObject); if (!_gck_call_basic_finish (result, error)) return NULL; @@ -1655,7 +1655,7 @@ gck_session_find_handles_finish (GckSession *self, g_return_val_if_fail (n_handles != NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); - args = _gck_call_arguments (result, FindObjects); + args = _gck_call_async_result_arguments (result, FindObjects); if (!_gck_call_basic_finish (result, error)) return NULL; @@ -1982,7 +1982,7 @@ gck_session_generate_key_pair_finish (GckSession *self, g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - args = _gck_call_arguments (result, GenerateKeyPair); + args = _gck_call_async_result_arguments (result, GenerateKeyPair); if (!_gck_call_basic_finish (result, error)) return FALSE; @@ -2167,7 +2167,7 @@ gck_session_wrap_key_finish (GckSession *self, GAsyncResult *result, g_return_val_if_fail (GCK_IS_SESSION (self), NULL); g_return_val_if_fail (n_result, NULL); - args = _gck_call_arguments (result, WrapKey); + args = _gck_call_async_result_arguments (result, WrapKey); if (!_gck_call_basic_finish (result, error)) return NULL; @@ -2372,7 +2372,7 @@ gck_session_unwrap_key_finish (GckSession *self, GAsyncResult *result, GError ** g_return_val_if_fail (GCK_IS_SESSION (self), NULL); - args = _gck_call_arguments (result, UnwrapKey); + args = _gck_call_async_result_arguments (result, UnwrapKey); if (!_gck_call_basic_finish (result, error)) return NULL; @@ -2542,7 +2542,7 @@ gck_session_derive_key_finish (GckSession *self, GAsyncResult *result, GError ** g_return_val_if_fail (GCK_IS_SESSION (self), NULL); - args = _gck_call_arguments (result, DeriveKey); + args = _gck_call_async_result_arguments (result, DeriveKey); if (!_gck_call_basic_finish (result, error)) return NULL; @@ -2707,7 +2707,7 @@ crypt_finish (GckSession *self, GAsyncResult *result, gsize *n_result, GError ** if (!_gck_call_basic_finish (result, error)) return NULL; - args = _gck_call_arguments (result, Crypt); + args = _gck_call_async_result_arguments (result, Crypt); /* Steal the values from the results */ res = args->result; |