gdbus, p2p-gdbus: Replace asynchronous flushing function calls with 78/271278/2
authorAdam Michalski <a.michalski2@partner.samsung.com>
Thu, 17 Feb 2022 18:18:24 +0000 (19:18 +0100)
committerAdam Michalski <a.michalski2@partner.samsung.com>
Thu, 17 Feb 2022 18:34:34 +0000 (19:34 +0100)
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

benchmark/gdbus.c
benchmark/p2p-gdbus.c

index 158027f9b177cb6824059644c3d35fc1b0b45ed7..96b82ef9181fd9efdcdbec452b759868d49e7a79 100644 (file)
@@ -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);
index 407a3d70a4dfae00bee77a0d9d695390bebd0efa..3269e3bf07ec711a416270cb73343c50cad00393 100644 (file)
@@ -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);