From: Martin Willi Date: Mon, 24 Mar 2014 16:17:50 +0000 (+0100) Subject: unit-tests: Prevent a failing worker thread to go wild after it fails X-Git-Tag: 5.1.3rc1~4^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e8ff4f010f95ca5d6e36e5e0659d4a7d0f61d35;p=thirdparty%2Fstrongswan.git unit-tests: Prevent a failing worker thread to go wild after it fails A worker raises SIGUSR1 to inform the main thread that the test fails. The main thread then starts cancelling workers, but the offending thread should be terminated immediately to prevent it from test continuation. --- diff --git a/src/libstrongswan/tests/test_suite.c b/src/libstrongswan/tests/test_suite.c index 0f2e74b7ca..fb40b05c13 100644 --- a/src/libstrongswan/tests/test_suite.c +++ b/src/libstrongswan/tests/test_suite.c @@ -136,7 +136,8 @@ static inline void test_failure() else { pthread_kill(main_thread, SIGUSR1); - /* how can we stop just the thread? longjmp to a restore point? */ + /* terminate thread to prevent it from going wild */ + pthread_exit(NULL); } }