From: Adam Michalski Date: Thu, 17 Feb 2022 18:18:24 +0000 (+0100) Subject: gdbus, p2p-gdbus: Replace asynchronous flushing function calls with X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5621e22e298cfb94075cde173809a78a3bcda7aa;p=platform%2Fcore%2Fsystem%2Fdbus-tools.git gdbus, p2p-gdbus: Replace asynchronous flushing function calls with their synchronous counterparts More in-depth tests have shown that synchronous connection flushing produces more predictable results under heavy load. Moreover, it seems to be the only way to ensure stable and predictable execution flow, where under heavy load the server can become starved even for a few seconds. Change-Id: Ia99618b83a3b9d86fd132554583e6d3250b099f9 --- diff --git a/benchmark/gdbus.c b/benchmark/gdbus.c index 158027f..96b82ef 100644 --- a/benchmark/gdbus.c +++ b/benchmark/gdbus.c @@ -212,7 +212,6 @@ void Send(register int size, const char *name, const char *path, bool is_lt) else start = 0; - //GError *error = NULL; g_dbus_connection_call(conn, name, path, @@ -225,14 +224,14 @@ void Send(register int size, const char *name, const char *path, bool is_lt) NULL, NULL, NULL); - /*if(error != NULL) { - g_printerr("Error=%s\n", error->message); - g_error_free (error); - }*/ - g_dbus_connection_flush(conn, - NULL, /* GCancellable */ - NULL, /* GAsyncReadyCallback */ - NULL); /* user_data */ + GError *error = NULL; + g_dbus_connection_flush_sync(conn, + NULL, + &error); + if (error != NULL) { + g_printerr("Error=%s\n", error->message); + g_error_free (error); + } if(is_lt) { if(size <= ONE_PAGE_SIZE) usleep(5000); diff --git a/benchmark/p2p-gdbus.c b/benchmark/p2p-gdbus.c index 407a3d7..3269e3b 100644 --- a/benchmark/p2p-gdbus.c +++ b/benchmark/p2p-gdbus.c @@ -396,10 +396,14 @@ void Send(int size, const char *name, const char *path, const char *number, bool NULL, NULL, NULL); - g_dbus_connection_flush(connection, - NULL, /* GCancellable */ - NULL, /* GAsyncReadyCallback */ - NULL); /* user_data */ + GError *error = NULL; + g_dbus_connection_flush_sync(connection, + NULL, + &error); + if (error != NULL) { + g_printerr("Error=%s\n", error->message); + g_error_free (error); + } if (is_lt) { if (size <= ONE_PAGE_SIZE) usleep(5000);