[gnome-builder] egg-task-cache: Track the in-flight GTask used to fetch the value
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] egg-task-cache: Track the in-flight GTask used to fetch the value
- Date: Mon, 6 Mar 2017 21:59:38 +0000 (UTC)
commit 4ef15fc83f85a5b00c64a156cd4c4b85d6bbb1c7
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Mar 6 18:29:33 2017 +0100
egg-task-cache: Track the in-flight GTask used to fetch the value
Proper cancellation handling, when multiple tasks are queued for a
given key, requires that the in-flight GTask used to fetch the value be
separate from the ones that represent the egg_task_cache_get_async
callers. Fetching of the value should be aborted once all the queued
tasks have been cancelled.
Therefore, it is necessary to be able to access the in-flight GTask for
a given key from a GCancellable::cancelled handler. This is meant to
help with that.
https://bugzilla.gnome.org/show_bug.cgi?id=779660
contrib/egg/egg-task-cache.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/contrib/egg/egg-task-cache.c b/contrib/egg/egg-task-cache.c
index d1830cb..8d7493e 100644
--- a/contrib/egg/egg-task-cache.c
+++ b/contrib/egg/egg-task-cache.c
@@ -518,7 +518,7 @@ egg_task_cache_get_async (EggTaskCache *self,
self->key_copy_func ((gpointer)key));
g_hash_table_insert (self->in_flight,
self->key_copy_func ((gpointer)key),
- GINT_TO_POINTER (TRUE));
+ g_object_ref (fetch_task));
self->populate_callback (self,
key,
g_object_ref (fetch_task),
@@ -634,7 +634,7 @@ egg_task_cache_constructed (GObject *object)
self->in_flight = g_hash_table_new_full (self->key_hash_func,
self->key_equal_func,
self->key_destroy_func,
- NULL);
+ g_object_unref);
/*
* This is where tasks queue waiting for an in_flight callback.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]