mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 04:12:01 +08:00
Prevent rare crashes
This commit is contained in:
parent
c41510e86b
commit
43506ee376
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user