diff --git a/.gitignore b/.gitignore
index 11b0674..7d7cad2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,4 +49,5 @@
 /test/internal_sdref
 /test/internal_utils
 /test/source_base
+/test/source_event
 /test/source_time
diff --git a/src/Makefile.am b/src/Makefile.am
index d4e7906..130c8e5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,6 +24,9 @@
 nobase_include_HEADERS += sdeventplus/source/base.hpp
 libsdeventplus_la_SOURCES += sdeventplus/source/base.cpp
 
+nobase_include_HEADERS += sdeventplus/source/event.hpp
+libsdeventplus_la_SOURCES += sdeventplus/source/event.cpp
+
 nobase_include_HEADERS += sdeventplus/source/time.hpp
 libsdeventplus_la_SOURCES += sdeventplus/source/time.cpp
 
diff --git a/src/sdeventplus/internal/sdevent.hpp b/src/sdeventplus/internal/sdevent.hpp
index 9a6ec07..a24c73c 100644
--- a/src/sdeventplus/internal/sdevent.hpp
+++ b/src/sdeventplus/internal/sdevent.hpp
@@ -22,6 +22,15 @@
                                   uint64_t accuracy,
                                   sd_event_time_handler_t callback,
                                   void* userdata) const = 0;
+    virtual int sd_event_add_defer(sd_event* event, sd_event_source** source,
+                                   sd_event_handler_t callback,
+                                   void* userdata) const = 0;
+    virtual int sd_event_add_post(sd_event* event, sd_event_source** source,
+                                  sd_event_handler_t callback,
+                                  void* userdata) const = 0;
+    virtual int sd_event_add_exit(sd_event* event, sd_event_source** source,
+                                  sd_event_handler_t callback,
+                                  void* userdata) const = 0;
 
     virtual int sd_event_prepare(sd_event* event) const = 0;
     virtual int sd_event_wait(sd_event* event, uint64_t usec) const = 0;
@@ -105,6 +114,27 @@
                                    callback, userdata);
     }
 
+    int sd_event_add_defer(sd_event* event, sd_event_source** source,
+                           sd_event_handler_t callback,
+                           void* userdata) const override
+    {
+        return ::sd_event_add_defer(event, source, callback, userdata);
+    }
+
+    int sd_event_add_post(sd_event* event, sd_event_source** source,
+                          sd_event_handler_t callback,
+                          void* userdata) const override
+    {
+        return ::sd_event_add_post(event, source, callback, userdata);
+    }
+
+    int sd_event_add_exit(sd_event* event, sd_event_source** source,
+                          sd_event_handler_t callback,
+                          void* userdata) const override
+    {
+        return ::sd_event_add_exit(event, source, callback, userdata);
+    }
+
     int sd_event_prepare(sd_event* event) const override
     {
         return ::sd_event_prepare(event);
diff --git a/src/sdeventplus/source/event.cpp b/src/sdeventplus/source/event.cpp
new file mode 100644
index 0000000..694c50a
--- /dev/null
+++ b/src/sdeventplus/source/event.cpp
@@ -0,0 +1,60 @@
+#include <sdeventplus/internal/sdevent.hpp>
+#include <sdeventplus/source/event.hpp>
+#include <utility>
+
+namespace sdeventplus
+{
+namespace source
+{
+
+Event::Event(const char* name, CreateFunc create,
+             const sdeventplus::Event& event, Callback&& callback) :
+    Base(event, create_source(name, create, event), std::false_type()),
+    callback(std::move(callback))
+{
+}
+
+const Event::Callback& Event::get_callback() const
+{
+    return callback;
+}
+
+sd_event_source* Event::create_source(const char* name, CreateFunc create,
+                                      const sdeventplus::Event& event)
+{
+    sd_event_source* source;
+    int r = (event.getSdEvent()->*create)(event.get(), &source, eventCallback,
+                                          nullptr);
+    if (r < 0)
+    {
+        throw SdEventError(-r, name);
+    }
+    return source;
+}
+
+int Event::eventCallback(sd_event_source* source, void* userdata)
+{
+    return sourceCallback<Callback, Event, &Event::get_callback>(
+        "eventCallback", source, userdata);
+}
+
+Defer::Defer(const sdeventplus::Event& event, Callback&& callback) :
+    Event("sd_event_add_defer", &internal::SdEvent::sd_event_add_defer, event,
+          std::move(callback))
+{
+}
+
+Post::Post(const sdeventplus::Event& event, Callback&& callback) :
+    Event("sd_event_add_post", &internal::SdEvent::sd_event_add_post, event,
+          std::move(callback))
+{
+}
+
+Exit::Exit(const sdeventplus::Event& event, Callback&& callback) :
+    Event("sd_event_add_exit", &internal::SdEvent::sd_event_add_exit, event,
+          std::move(callback))
+{
+}
+
+} // namespace source
+} // namespace sdeventplus
diff --git a/src/sdeventplus/source/event.hpp b/src/sdeventplus/source/event.hpp
new file mode 100644
index 0000000..6375d7c
--- /dev/null
+++ b/src/sdeventplus/source/event.hpp
@@ -0,0 +1,54 @@
+#pragma once
+
+#include <functional>
+#include <sdeventplus/internal/sdevent.hpp>
+#include <sdeventplus/source/base.hpp>
+#include <systemd/sd-event.h>
+
+namespace sdeventplus
+{
+namespace source
+{
+
+class Event : public Base
+{
+  public:
+    using Callback = std::function<void(Event& source)>;
+
+  protected:
+    using CreateFunc = decltype(&internal::SdEvent::sd_event_add_exit);
+
+    Event(const char* name, CreateFunc create, const sdeventplus::Event& event,
+          Callback&& callback);
+
+  private:
+    Callback callback;
+
+    const Callback& get_callback() const;
+
+    static sd_event_source* create_source(const char* name, CreateFunc create,
+                                          const sdeventplus::Event& event);
+
+    static int eventCallback(sd_event_source* source, void* userdata);
+};
+
+class Defer : public Event
+{
+  public:
+    Defer(const sdeventplus::Event& event, Callback&& Callback);
+};
+
+class Post : public Event
+{
+  public:
+    Post(const sdeventplus::Event& event, Callback&& callback);
+};
+
+class Exit : public Event
+{
+  public:
+    Exit(const sdeventplus::Event& event, Callback&& callback);
+};
+
+} // namespace source
+} // namespace sdeventplus
diff --git a/src/sdeventplus/test/sdevent.hpp b/src/sdeventplus/test/sdevent.hpp
index 1e90bc7..ce386d6 100644
--- a/src/sdeventplus/test/sdevent.hpp
+++ b/src/sdeventplus/test/sdevent.hpp
@@ -20,6 +20,12 @@
     MOCK_CONST_METHOD7(sd_event_add_time,
                        int(sd_event*, sd_event_source**, clockid_t, uint64_t,
                            uint64_t, sd_event_time_handler_t, void*));
+    MOCK_CONST_METHOD4(sd_event_add_defer, int(sd_event*, sd_event_source**,
+                                               sd_event_handler_t, void*));
+    MOCK_CONST_METHOD4(sd_event_add_post, int(sd_event*, sd_event_source**,
+                                              sd_event_handler_t, void*));
+    MOCK_CONST_METHOD4(sd_event_add_exit, int(sd_event*, sd_event_source**,
+                                              sd_event_handler_t, void*));
 
     MOCK_CONST_METHOD1(sd_event_prepare, int(sd_event*));
     MOCK_CONST_METHOD2(sd_event_wait, int(sd_event*, uint64_t));
diff --git a/test/Makefile.am b/test/Makefile.am
index 8fc2beb..49c7402 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -37,6 +37,11 @@
 source_base_CPPFLAGS = $(gtest_cppflags)
 source_base_LDADD = $(gtest_ldadd)
 
+check_PROGRAMS += source_event
+source_event_SOURCES = source/event.cpp
+source_event_CPPFLAGS = $(gtest_cppflags)
+source_event_LDADD = $(gtest_ldadd)
+
 check_PROGRAMS += source_time
 source_time_SOURCES = source/time.cpp
 source_time_CPPFLAGS = $(gtest_cppflags)
diff --git a/test/source/event.cpp b/test/source/event.cpp
new file mode 100644
index 0000000..5f19e81
--- /dev/null
+++ b/test/source/event.cpp
@@ -0,0 +1,152 @@
+#include <cerrno>
+#include <functional>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <memory>
+#include <sdeventplus/event.hpp>
+#include <sdeventplus/exception.hpp>
+#include <sdeventplus/source/event.hpp>
+#include <sdeventplus/test/sdevent.hpp>
+#include <systemd/sd-event.h>
+#include <utility>
+
+namespace sdeventplus
+{
+namespace source
+{
+namespace
+{
+
+using testing::DoAll;
+using testing::Return;
+using testing::SaveArg;
+using testing::SetArgPointee;
+
+using UniqueEvent = std::unique_ptr<sdeventplus::Event,
+                                    std::function<void(sdeventplus::Event*)>>;
+
+class EventTest : public testing::Test
+{
+  protected:
+    testing::StrictMock<test::SdEventMock> mock;
+    sd_event_source* const expected_source =
+        reinterpret_cast<sd_event_source*>(1234);
+    sd_event* const expected_event = reinterpret_cast<sd_event*>(2345);
+    UniqueEvent event = make_event(expected_event);
+
+    UniqueEvent make_event(sd_event* event)
+    {
+        auto deleter = [this, event](sdeventplus::Event* e) {
+            EXPECT_CALL(this->mock, sd_event_unref(event))
+                .WillOnce(Return(nullptr));
+            delete e;
+        };
+        return UniqueEvent(
+            new sdeventplus::Event(event, std::false_type(), &mock), deleter);
+    }
+
+    void expect_destruct()
+    {
+        {
+            testing::InSequence sequence;
+            EXPECT_CALL(mock, sd_event_source_set_enabled(expected_source,
+                                                          SD_EVENT_OFF))
+                .WillOnce(Return(0));
+            EXPECT_CALL(mock, sd_event_source_unref(expected_source))
+                .WillOnce(Return(nullptr));
+        }
+        EXPECT_CALL(mock, sd_event_unref(expected_event))
+            .WillOnce(Return(nullptr));
+    }
+};
+
+TEST_F(EventTest, DeferConstruct)
+{
+    EXPECT_CALL(mock, sd_event_ref(expected_event))
+        .WillOnce(Return(expected_event));
+    void* userdata;
+    EXPECT_CALL(mock, sd_event_source_set_userdata(expected_source, testing::_))
+        .WillOnce(DoAll(SaveArg<1>(&userdata), Return(nullptr)));
+    sd_event_handler_t handler;
+    EXPECT_CALL(mock, sd_event_add_defer(expected_event, testing::_, testing::_,
+                                         nullptr))
+        .WillOnce(DoAll(SetArgPointee<1>(expected_source), SaveArg<2>(&handler),
+                        Return(0)));
+    int completions = 0;
+    Event::Callback callback = [&completions](Event&) { completions++; };
+    Defer defer(*event, std::move(callback));
+    EXPECT_EQ(&defer, userdata);
+    EXPECT_FALSE(callback);
+    EXPECT_EQ(0, completions);
+
+    EXPECT_EQ(0, handler(nullptr, &defer));
+    EXPECT_EQ(1, completions);
+
+    expect_destruct();
+}
+
+TEST_F(EventTest, PostConstruct)
+{
+    EXPECT_CALL(mock, sd_event_ref(expected_event))
+        .WillOnce(Return(expected_event));
+    void* userdata;
+    EXPECT_CALL(mock, sd_event_source_set_userdata(expected_source, testing::_))
+        .WillOnce(DoAll(SaveArg<1>(&userdata), Return(nullptr)));
+    sd_event_handler_t handler;
+    EXPECT_CALL(mock, sd_event_add_post(expected_event, testing::_, testing::_,
+                                        nullptr))
+        .WillOnce(DoAll(SetArgPointee<1>(expected_source), SaveArg<2>(&handler),
+                        Return(0)));
+    int completions = 0;
+    Event::Callback callback = [&completions](Event&) { completions++; };
+    Post post(*event, std::move(callback));
+    EXPECT_EQ(&post, userdata);
+    EXPECT_FALSE(callback);
+    EXPECT_EQ(0, completions);
+
+    EXPECT_EQ(0, handler(nullptr, &post));
+    EXPECT_EQ(1, completions);
+
+    expect_destruct();
+}
+
+TEST_F(EventTest, ExitConstruct)
+{
+    EXPECT_CALL(mock, sd_event_ref(expected_event))
+        .WillOnce(Return(expected_event));
+    void* userdata;
+    EXPECT_CALL(mock, sd_event_source_set_userdata(expected_source, testing::_))
+        .WillOnce(DoAll(SaveArg<1>(&userdata), Return(nullptr)));
+    sd_event_handler_t handler;
+    EXPECT_CALL(mock, sd_event_add_exit(expected_event, testing::_, testing::_,
+                                        nullptr))
+        .WillOnce(DoAll(SetArgPointee<1>(expected_source), SaveArg<2>(&handler),
+                        Return(0)));
+    int completions = 0;
+    Event::Callback callback = [&completions](Event&) { completions++; };
+    Exit exit(*event, std::move(callback));
+    EXPECT_EQ(&exit, userdata);
+    EXPECT_FALSE(callback);
+    EXPECT_EQ(0, completions);
+
+    EXPECT_EQ(0, handler(nullptr, &exit));
+    EXPECT_EQ(1, completions);
+
+    expect_destruct();
+}
+
+TEST_F(EventTest, ConstructFailure)
+{
+    EXPECT_CALL(mock, sd_event_add_defer(expected_event, testing::_, testing::_,
+                                         nullptr))
+        .WillOnce(Return(-EINVAL));
+    int completions = 0;
+    Event::Callback callback = [&completions](Event&) { completions++; };
+    EXPECT_THROW(Defer(*event, std::move(callback)), SdEventError);
+    EXPECT_TRUE(callback);
+    EXPECT_EQ(0, completions);
+}
+
+} // namespace
+} // namespace source
+} // namespace sdeventplus
