ContextSpecificGroup: some fixups

For all of the effort spent ensuring that this algorithm would be
correctly threadsafe, I messed up the order of operations within a
single thread when porting to the new approach.

Fix that up.

Also: fix some overzealous asserting in the testcases.  Since shutdown
is now lazy, we can never surely say !is_running at any particular point
in time.
This commit is contained in:
Ryan Lortie
2015-03-13 17:34:57 -04:00
parent 7a3c8e900a
commit 0de16c98f7
2 changed files with 5 additions and 7 deletions

View File

@@ -182,10 +182,6 @@ g_context_specific_group_get (GContextSpecificGroup *group,
if (!group->table)
group->table = g_hash_table_new (NULL, NULL);
/* start only if there are no others */
if (start_func && g_hash_table_size (group->table) == 0)
g_context_specific_group_request_state (group, TRUE, start_func);
css = g_hash_table_lookup (group->table, context);
if (!css)
@@ -202,6 +198,9 @@ g_context_specific_group_get (GContextSpecificGroup *group,
else
g_object_ref (css->instance);
if (start_func)
g_context_specific_group_request_state (group, TRUE, start_func);
g_mutex_unlock (&group->lock);
return css->instance;