From: Michal 'vorner' Vaner Date: Mon, 1 Oct 2012 13:17:51 +0000 (+0200) Subject: [2202] Try throwing std::exception too X-Git-Tag: trac2402_base~79^2~5^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=310150445a17a5043cb5e93ce5ecaddd0336b196;p=thirdparty%2Fkea.git [2202] Try throwing std::exception too --- diff --git a/src/lib/util/threads/tests/thread_unittest.cc b/src/lib/util/threads/tests/thread_unittest.cc index 97cace2a53..4d477ee987 100644 --- a/src/lib/util/threads/tests/thread_unittest.cc +++ b/src/lib/util/threads/tests/thread_unittest.cc @@ -73,18 +73,28 @@ throwSomething() { throw 42; // Throw something really unusual, to see everything is caught. } +void +throwException() { + throw std::exception(); +} + // Exception in the thread we forget about should not do anything to us TEST(ThreadTest, detachedException) { for (size_t i = 0; i < detached_iterations; ++i) { Thread thread(throwSomething); } + for (size_t i = 0; i < detached_iterations; ++i) { + Thread thread(throwException); + } } // An uncaught exception in the thread should propagate through wait TEST(ThreadTest, exception) { for (size_t i = 0; i < iterations; ++i) { Thread thread(throwSomething); + Thread thread2(throwException); ASSERT_THROW(thread.wait(), Thread::UncaughtException); + ASSERT_THROW(thread2.wait(), Thread::UncaughtException); } }