Add loop exit wrapper

Add a wrapper for sd_event_exit.

Change-Id: Ie08a74cb388e8441683fbf90902cbcb463aa9e6f
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/sdevent/event.hpp b/sdevent/event.hpp
index 3e97ce7..9f04dd0 100644
--- a/sdevent/event.hpp
+++ b/sdevent/event.hpp
@@ -87,6 +87,29 @@
             sd_event_loop(evt.get());
         }
 
+        /** @brief Stop the loop. */
+        void exit(int status = 0)
+        {
+            auto rc = sd_event_exit(evt.get(), status);
+            if (rc < 0)
+            {
+                phosphor::logging::elog<InternalFailure>();
+            }
+        }
+
+        /** @brief Get the loop exit code. */
+        auto getExitStatus()
+        {
+            int status;
+            auto rc = sd_event_get_exit_code(evt.get(), &status);
+            if (rc < 0)
+            {
+                phosphor::logging::elog<InternalFailure>();
+            }
+
+            return status;
+        }
+
         /** @brief Attach to a DBus loop. */
         void attach(sdbusplus::bus::bus& bus)
         {