summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-pending-call.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-08-15 23:10:12 +0000
committerHavoc Pennington <hp@redhat.com>2003-08-15 23:10:12 +0000
commita1b0bd33408f03894987ac32b4e6b46c6a15a594 (patch)
tree2903a89983ce0efa1d3480b5d76322a325e621da /dbus/dbus-pending-call.c
parentef614207fc4f03e5cc02faeb109f739eb1ccdf31 (diff)
2003-08-15 Havoc Pennington <hp@redhat.com>
* dbus/dbus-pending-call.c (dbus_pending_call_block): implement * dbus/dbus-connection.c (dbus_connection_send_with_reply_and_block): factor out internals; change to convert any error replies to DBusError instead of returning them as a message
Diffstat (limited to 'dbus/dbus-pending-call.c')
-rw-r--r--dbus/dbus-pending-call.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/dbus/dbus-pending-call.c b/dbus/dbus-pending-call.c
index 84ca7ae0..2b6021e9 100644
--- a/dbus/dbus-pending-call.c
+++ b/dbus/dbus-pending-call.c
@@ -254,6 +254,31 @@ dbus_pending_call_get_reply (DBusPendingCall *pending)
return pending->reply;
}
+/**
+ * Block until the pending call is completed. The blocking is as with
+ * dbus_connection_send_with_reply_and_block(); it does not enter the
+ * main loop or process other messages, it simply waits for the reply
+ * in question.
+ *
+ * @todo when you start blocking, the timeout is reset, but it should
+ * really only use time remaining since the pending call was created.
+ *
+ * @param pending the pending call
+ */
+void
+dbus_pending_call_block (DBusPendingCall *pending)
+{
+ DBusMessage *message;
+
+ message = _dbus_connection_block_for_reply (pending->connection,
+ pending->reply_serial,
+ dbus_timeout_get_interval (pending->timeout));
+
+ _dbus_connection_lock (pending->connection);
+ _dbus_pending_call_complete_and_unlock (pending, message);
+ dbus_message_unref (message);
+}
+
/** @} */
#ifdef DBUS_BUILD_TESTS