[telepathy-mission-control/master] McdDispatchOperation: reverse sense of invoking_early_clients flag, and simplify

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Nov 2 06:41:48 PST 2009


Having this start off locked means that calling
_mcd_dispatch_operation_check_client_locks too early is harmless.
---
 src/mcd-dispatch-operation-priv.h |    6 ++----
 src/mcd-dispatch-operation.c      |   20 ++++++++------------
 src/mcd-dispatcher.c              |    5 +----
 3 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/src/mcd-dispatch-operation-priv.h b/src/mcd-dispatch-operation-priv.h
index 8a97ccc..f975f95 100644
--- a/src/mcd-dispatch-operation-priv.h
+++ b/src/mcd-dispatch-operation-priv.h
@@ -127,11 +127,9 @@ G_GNUC_INTERNAL void _mcd_dispatch_operation_inc_ado_pending (
 G_GNUC_INTERNAL void _mcd_dispatch_operation_dec_ado_pending (
     McdDispatchOperation *self);
 
-/* Temporary client lock while starting observers/approvers */
-G_GNUC_INTERNAL gboolean _mcd_dispatch_operation_is_invoking_early_clients (
+/* Temporary client lock until observers/approvers have been started */
+G_GNUC_INTERNAL void _mcd_dispatch_operation_set_invoked_early_clients (
     McdDispatchOperation *self);
-G_GNUC_INTERNAL void _mcd_dispatch_operation_set_invoking_early_clients (
-    McdDispatchOperation *self, gboolean value);
 
 /* Client lock while waiting for approvers' opinion */
 G_GNUC_INTERNAL gboolean _mcd_dispatch_operation_is_awaiting_approval (
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index b52f3c8..1def4c0 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -128,11 +128,11 @@ struct _McdDispatchOperationPrivate
      * McdDispatcherContext, CTXREF14 ensures this). */
     gboolean awaiting_approval;
 
-    /* If TRUE, we're still working out what Observers and Approvers to
+    /* If FALSE, we're still working out what Observers and Approvers to
      * run. This is a temporary client lock; a reference must be held
-     * while it is TRUE (in the McdDispatcherContext, CTXREF07 ensures this).
+     * for as long as it is FALSE.
      */
-    gboolean invoking_early_clients;
+    gboolean invoked_early_clients;
 
     /* The number of observers that have not yet returned from ObserveChannels.
      * Until they have done so, we can't allow the dispatch operation to
@@ -251,17 +251,13 @@ _mcd_dispatch_operation_dec_ado_pending (McdDispatchOperation *self)
 }
 
 void
-_mcd_dispatch_operation_set_invoking_early_clients (McdDispatchOperation *self,
-                                                    gboolean value)
+_mcd_dispatch_operation_set_invoked_early_clients (McdDispatchOperation *self)
 {
     g_return_if_fail (MCD_IS_DISPATCH_OPERATION (self));
-    g_return_if_fail (self->priv->invoking_early_clients == !value);
-    self->priv->invoking_early_clients = value;
+    g_return_if_fail (self->priv->invoked_early_clients == FALSE);
+    self->priv->invoked_early_clients = TRUE;
 
-    if (!value)
-    {
-        _mcd_dispatch_operation_check_client_locks (self);
-    }
+    _mcd_dispatch_operation_check_client_locks (self);
 }
 
 gboolean
@@ -289,7 +285,7 @@ _mcd_dispatch_operation_get_cancelled (McdDispatchOperation *self)
 void
 _mcd_dispatch_operation_check_client_locks (McdDispatchOperation *self)
 {
-    if (!self->priv->invoking_early_clients &&
+    if (self->priv->invoked_early_clients &&
         !_mcd_dispatch_operation_has_observers_pending (self) &&
         _mcd_dispatch_operation_is_approved (self))
     {
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 7a21da2..c908204 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1065,8 +1065,6 @@ static void
 mcd_dispatcher_run_clients (McdDispatcherContext *context)
 {
     mcd_dispatcher_context_ref (context, "CTXREF07");
-    _mcd_dispatch_operation_set_invoking_early_clients (context->operation,
-                                                        TRUE);
 
     mcd_dispatcher_run_observers (context);
 
@@ -1087,8 +1085,7 @@ mcd_dispatcher_run_clients (McdDispatcherContext *context)
             mcd_dispatcher_run_approvers (context);
     }
 
-    _mcd_dispatch_operation_set_invoking_early_clients (context->operation,
-                                                        FALSE);
+    _mcd_dispatch_operation_set_invoked_early_clients (context->operation);
     mcd_dispatcher_context_unref (context, "CTXREF07");
 }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list