From 07f8fb12646dccb535a5388da75b2b2eabeb36df Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 4 Jul 2014 12:12:15 +0200 Subject: [PATCH] Prevent concurrency issues by blocking until background threads are killed --- lib/Slic3r.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 140eb738d..04e8ed72a 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -190,10 +190,12 @@ sub thread_cleanup { sub kill_all_threads { # detach any running thread created in the current one + my @killed = (); foreach my $thread (grep defined($_), map threads->object($_), @threads) { $thread->kill('KILL'); - $thread->detach; + push @killed, $thread; } + $_->join for @killed; # block until threads are killed @threads = (); }