From a1b0bd33408f03894987ac32b4e6b46c6a15a594 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Fri, 15 Aug 2003 23:10:12 +0000 Subject: 2003-08-15 Havoc Pennington * 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 --- dbus/dbus-pending-call.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'dbus/dbus-pending-call.c') 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 -- cgit