From aefdb29318d391e6e8a85c07c08fad8e001a591e Mon Sep 17 00:00:00 2001 From: Hyotaek Shim Date: Thu, 28 Apr 2016 19:35:50 +0900 Subject: [PATCH] Bug fix for kdbus_do_iteration() causing busy loop Change-Id: I75a6267471b7fdff2d147514210726a3cec6c5dd Signed-off-by: Hyotaek Shim --- dbus/dbus-transport-kdbus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dbus/dbus-transport-kdbus.c b/dbus/dbus-transport-kdbus.c index e9aca6f7..03de72e7 100644 --- a/dbus/dbus-transport-kdbus.c +++ b/dbus/dbus-transport-kdbus.c @@ -3726,11 +3726,16 @@ kdbus_do_iteration (DBusTransport *transport, * When timeout is set to -1 in client application, * error messages are inserted directly to incoming queue and * application hangs on dbus_poll. - */ + * + * This causes a busy loop in _dbus_connection_block_pending_call() + * There is no case of waiting for the locally-generated error reply + if (_dbus_connection_get_n_incoming (transport->connection) > 0) { timeout_milliseconds = 0; } + */ + /* This is kind of a hack; if we have stuff to write, then try * to avoid the poll. This is probably about a 5% speedup on an * echo client/server. -- 2.34.1