From: Vincent Pit Date: Mon, 20 Jul 2015 22:33:23 +0000 (-0300) Subject: Harden spawned threads against stray exit X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVPIT-TestHelpers.git;a=commitdiff_plain;h=ba865c42d13de4c435b55379b0a32fe232053668 Harden spawned threads against stray exit The thread may call exit if malloc() fails at some point, which will cause the whole process to crash. We prevent this by passing 'exit => "threads_only"' to the threads.pm import method, which requires threads.pm version 1.37. --- diff --git a/lib/VPIT/TestHelpers.pm b/lib/VPIT/TestHelpers.pm index 476ce9b..75ca216 100644 --- a/lib/VPIT/TestHelpers.pm +++ b/lib/VPIT/TestHelpers.pm @@ -600,6 +600,18 @@ C =back +=item * + +Notes : + +=over 8 + +=item - + +C<< exit => 'threads_only' >> is passed to C<< threads->import >>. + +=back + =back =cut @@ -644,7 +656,9 @@ sub init_threads { die "$test_module was loaded too soon" if defined $test_module; } - load_or_skip_all 'threads', $force ? '0' : '1.67', [ ]; + load_or_skip_all 'threads', $force ? '0' : '1.67', [ + exit => 'threads_only', + ]; load_or_skip_all 'threads::shared', $force ? '0' : '1.14', [ ]; diag "Threads testing forced by \$ENV{$force_var}" if $force;