button-handler: use sdeventplus loop
Use the sdeventplus event loop so that an upcoming commit can make use
of sdeventplus timers.
Change-Id: I596ee36141f16ceb5e95078bad9fbe6a12c832a6
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/src/button_handler_main.cpp b/src/button_handler_main.cpp
index e71f8e4..7c21fe9 100644
--- a/src/button_handler_main.cpp
+++ b/src/button_handler_main.cpp
@@ -1,15 +1,15 @@
#include "button_handler.hpp"
+#include <sdeventplus/event.hpp>
+
int main(void)
{
auto bus = sdbusplus::bus::new_default();
+ auto event = sdeventplus::Event::get_default();
+
+ bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
phosphor::button::Handler handler{bus};
- while (true)
- {
- bus.process_discard();
- bus.wait();
- }
- return 0;
+ return event.loop();
}