main: use process loop

In reference [1], sdbusplus introduces its own process loop. This patch
uses the sdbusplus built-in process loop instead of writing our own
loop.

[1] https://gerrit.openbmc.org/c/openbmc/sdbusplus/+/56891

Tested: the local user manager daemon is working correct on QEMU.

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I7fc51b463a0c02be707f5778ceba40087af8e131
diff --git a/mainapp.cpp b/mainapp.cpp
index d8258cc..fa5f9f6 100644
--- a/mainapp.cpp
+++ b/mainapp.cpp
@@ -17,7 +17,8 @@
 
 #include "user_mgr.hpp"
 
-#include <string>
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/server/manager.hpp>
 
 // D-Bus root for user manager
 constexpr auto userManagerRoot = "/xyz/openbmc_project/user";
@@ -33,11 +34,5 @@
     bus.request_name(USER_MANAGER_BUSNAME);
 
     // Wait for client request
-    while (true)
-    {
-        // process dbus calls / signals discarding unhandled
-        bus.process_discard();
-        bus.wait();
-    }
-    return 0;
+    bus.process_loop();
 }