[telepathy-mission-control/master] Replace McdDispatcherContext->client_locks with a boolean
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Sep 8 09:08:38 PDT 2009
It only has one use, now.
---
src/mcd-dispatcher.c | 28 +++++++++-------------------
1 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index cd6eabe..d1e7275 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -105,6 +105,11 @@ struct _McdDispatcherContext
* CTXREF14 is held while we await approval. */
guint awaiting_approval : 1;
+ /* If TRUE, we're still working out what Observers and Approvers to
+ * run. This is a temporary client lock. CTXREF07 is held while this
+ * lock is active. */
+ guint invoking_clients : 1;
+
McdDispatcher *dispatcher;
GList *channels;
@@ -128,12 +133,6 @@ struct _McdDispatcherContext
* One instance of CTXREF06 is held for each pending approver. */
gsize approvers_pending;
- /* The number of other miscellaneous locks preventing
- * handlers from running; there's only one now, which is temporary.
- *
- * CTXREF07 is held while this lock is active. */
- gint client_locks;
-
gchar *protocol;
/* State-machine internal data fields: */
@@ -1025,7 +1024,7 @@ finally:
static void
mcd_dispatcher_context_check_client_locks (McdDispatcherContext *context)
{
- if (context->client_locks == 0 &&
+ if (!context->invoking_clients &&
context->observers_pending == 0 &&
context->approvers_pending == 0 &&
!context->awaiting_approval)
@@ -1036,15 +1035,6 @@ mcd_dispatcher_context_check_client_locks (McdDispatcherContext *context)
}
static void
-mcd_dispatcher_context_release_client_lock (McdDispatcherContext *context)
-{
- DEBUG ("called on %p, locks = %d", context, context->client_locks);
- g_return_if_fail (context->client_locks > 0);
- context->client_locks--;
- mcd_dispatcher_context_check_client_locks (context);
-}
-
-static void
mcd_dispatcher_context_release_pending_observer (McdDispatcherContext *context)
{
DEBUG ("called on %p, %" G_GSIZE_FORMAT " pending",
@@ -1371,8 +1361,7 @@ static void
mcd_dispatcher_run_clients (McdDispatcherContext *context)
{
mcd_dispatcher_context_ref (context, "CTXREF07");
- context->client_locks = 1; /* we release this lock at the end of the
- function */
+ context->invoking_clients = TRUE;
mcd_dispatcher_run_observers (context);
@@ -1387,7 +1376,8 @@ mcd_dispatcher_run_clients (McdDispatcherContext *context)
mcd_dispatcher_run_approvers (context);
}
- mcd_dispatcher_context_release_client_lock (context);
+ context->invoking_clients = FALSE;
+ mcd_dispatcher_context_check_client_locks (context);
mcd_dispatcher_context_unref (context, "CTXREF07");
}
--
1.5.6.5
More information about the telepathy-commits
mailing list