summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-01-25 12:35:07 +0000
committerSimon McVittie <smcv@collabora.com>2018-02-06 19:14:27 +0000
commit3c73f2e8f379b3d1f4f8c0db9382472b3a8c3fb9 (patch)
treedf485a336d47f9ce046eac3e5d12e05bbdadbd0b
parenta6e5364d842d81b959a558c1242b54c021120c15 (diff)
downloaddbus-3c73f2e8f379b3d1f4f8c0db9382472b3a8c3fb9.tar.gz
DBusPendingCall: Improve doc-comments around completed flag
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=102839 Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> (cherry picked from commit 57a0cf1d14c20765bfc7a36234955b14f3811f2a)
-rw-r--r--dbus/dbus-pending-call.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/dbus/dbus-pending-call.c b/dbus/dbus-pending-call.c
index 1bc5d1e5..d057b49b 100644
--- a/dbus/dbus-pending-call.c
+++ b/dbus/dbus-pending-call.c
@@ -75,8 +75,16 @@ struct DBusPendingCall
dbus_uint32_t reply_serial; /**< Expected serial of reply */
- unsigned int completed : 1; /**< TRUE if completed */
- unsigned int timeout_added : 1; /**< Have added the timeout */
+ /**
+ * TRUE if some thread has taken responsibility for completing this
+ * pending call: either the pending call has completed, or it is about
+ * to be completed. Protected by the connection lock.
+ */
+ unsigned int completed : 1;
+ /**
+ * TRUE if we have added the timeout. Protected by the connection lock.
+ */
+ unsigned int timeout_added : 1;
};
static void
@@ -196,6 +204,11 @@ _dbus_pending_call_set_reply_unlocked (DBusPendingCall *pending,
/**
* Sets the pending call to completed
*
+ * This method is called with the connection lock held, to protect
+ * pending->completed. It must be paired with a call to
+ * _dbus_pending_call_finish_completion() after the connection lock has
+ * been released.
+ *
* @param pending the pending call
*/
void
@@ -209,6 +222,10 @@ _dbus_pending_call_start_completion_unlocked (DBusPendingCall *pending)
/**
* Call the notifier function for the pending call.
*
+ * This method must be called after the connection lock has been
+ * released, and must be paired with a call to
+ * _dbus_pending_call_start_completion_unlocked().
+ *
* @param pending the pending call
*/
void