]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
unit-tests: Prevent a failing worker thread to go wild after it fails
authorMartin Willi <martin@revosec.ch>
Mon, 24 Mar 2014 16:17:50 +0000 (17:17 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 1 Apr 2014 12:28:54 +0000 (14:28 +0200)
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.

src/libstrongswan/tests/test_suite.c

index 0f2e74b7ca13943542320b5e3925b0274903247a..fb40b05c13be6710fcf3759c2ead434f27c68ad2 100644 (file)
@@ -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);
        }
 }