From 3c73f2e8f379b3d1f4f8c0db9382472b3a8c3fb9 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 25 Jan 2018 12:35:07 +0000 Subject: [PATCH] DBusPendingCall: Improve doc-comments around completed flag Bug: https://bugs.freedesktop.org/show_bug.cgi?id=102839 Signed-off-by: Simon McVittie Reviewed-by: Philip Withnall (cherry picked from commit 57a0cf1d14c20765bfc7a36234955b14f3811f2a) --- dbus/dbus-pending-call.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/dbus/dbus-pending-call.c b/dbus/dbus-pending-call.c index 1bc5d1e..d057b49 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 -- 2.7.4