add dummy event
diff --git a/scheduler/scheduler.cc b/scheduler/scheduler.cc
index 236d5e8..3720533 100644
--- a/scheduler/scheduler.cc
+++ b/scheduler/scheduler.cc
@@ -34,6 +34,12 @@
 
 #define EVLOOP_NO_EXIT_ON_EMPTY 0x04
 
+static void
+dummyCallback(evutil_socket_t fd, short what, void *arg)
+{
+  // 1 year later, that was a long run for the app
+}
+
 // IntervalGeneratorPtr
 // IntervalGenerator:: Null;
 
@@ -48,11 +54,26 @@
   event_set_fatal_callback(errorCallback);
   evthread_use_pthreads();
   m_base = event_base_new();
+
+  // This is a hack to prevent event_base_loop from exiting;
+  // the flag EVLOOP_NO_EXIT_ON_EMPTY is somehow ignored, at least on Mac OS X
+  // it's going to be scheduled to 10 years later
+  timeval tv;
+  tv.tv_sec = 365 * 24 * 3600;
+  tv.tv_usec = 0;
+  m_ev = evtimer_new(m_base, dummyCallback, 0);
+  int res = evtimer_add(m_ev, &tv);
+  if (res < 0)
+  {
+    _LOG_ERROR("heck");
+  }
 }
 
 Scheduler::~Scheduler()
 {
   shutdown ();
+  evtimer_del(m_ev);
+  event_free(m_ev);
   event_base_free(m_base);
 }
 
@@ -65,6 +86,10 @@
     {
       _LOG_DEBUG ("scheduler loop break error");
     }
+    else
+    {
+      _LOG_DEBUG ("scheduler loop break normal");
+    }
 
     {
       ScopedLock lock(m_mutex);
diff --git a/scheduler/scheduler.h b/scheduler/scheduler.h
index 6ba826a..58a0726 100644
--- a/scheduler/scheduler.h
+++ b/scheduler/scheduler.h
@@ -127,6 +127,7 @@
   Mutex m_mutex;
   volatile bool m_running;
   event_base *m_base;
+  event *m_ev;
   boost::thread m_thread;
 };