Prevent rare crashes

This commit is contained in:
Alessandro Ranellucci 2017-04-04 11:59:08 +02:00
parent c41510e86b
commit 43506ee376

View File

@ -103,11 +103,14 @@ sub spawn_thread {
my $parent_tid = threads->tid; my $parent_tid = threads->tid;
lock @threads; lock @threads;
# Set up a default handler for preventing crashes in case signals are received before
# thread sets its handlers.
$SIG{'STOP'} = sub {};
@_ = (); @_ = ();
my $thread = threads->create(sub { my $thread = threads->create(sub {
@my_threads = (); @my_threads = ();
Slic3r::debugf "Starting thread %d (parent: %d)...\n", threads->tid, $parent_tid;
local $SIG{'KILL'} = sub { local $SIG{'KILL'} = sub {
Slic3r::debugf "Exiting thread %d...\n", threads->tid; Slic3r::debugf "Exiting thread %d...\n", threads->tid;
$parallel_sema->up if $parallel_sema; $parallel_sema->up if $parallel_sema;
@ -119,6 +122,7 @@ sub spawn_thread {
$pause_sema->down; $pause_sema->down;
$pause_sema->up; $pause_sema->up;
}; };
Slic3r::debugf "Starting thread %d (parent: %d)...\n", threads->tid, $parent_tid;
$cb->(); $cb->();
}); });
push @my_threads, $thread->tid; push @my_threads, $thread->tid;