util: keep Scheduler running if a callback throws
refs #3722
Change-Id: Icf19e1a59d67e351b210a60079b27b9b0a06fae6
diff --git a/tests/unit-tests/util/scheduler.t.cpp b/tests/unit-tests/util/scheduler.t.cpp
index dfc2826..72db284 100644
--- a/tests/unit-tests/util/scheduler.t.cpp
+++ b/tests/unit-tests/util/scheduler.t.cpp
@@ -78,6 +78,21 @@
BOOST_CHECK_EQUAL(count2, 1);
}
+BOOST_AUTO_TEST_CASE(CallbackException)
+{
+ class MyException : public std::exception
+ {
+ };
+ scheduler.scheduleEvent(time::milliseconds(10), [] { BOOST_THROW_EXCEPTION(MyException()); });
+
+ bool isCallbackInvoked = false;
+ scheduler.scheduleEvent(time::milliseconds(20), [&isCallbackInvoked] { isCallbackInvoked = true; });
+
+ BOOST_CHECK_THROW(this->advanceClocks(time::milliseconds(6), 2), MyException);
+ this->advanceClocks(time::milliseconds(6), 2);
+ BOOST_CHECK(isCallbackInvoked);
+}
+
BOOST_AUTO_TEST_CASE(CancelEmptyEvent)
{
EventId i;