Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2013-09-19 18:00:47 +0400
committerAlessandro Ranellucci <aar@cpan.org>2013-09-19 18:00:47 +0400
commited529b62f31117e7c728267f460d806f6766335b (patch)
tree25ec2a64df34b6d1133c59ff76a0ff10803936e7 /t/threads.t
parentafdb490cf12e6db190d84d135ffe17de821494bb (diff)
Fix threading issue with GUI. #1443 #1444
Diffstat (limited to 't/threads.t')
-rw-r--r--t/threads.t39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/threads.t b/t/threads.t
new file mode 100644
index 000000000..420d58f36
--- /dev/null
+++ b/t/threads.t
@@ -0,0 +1,39 @@
+use Test::More;
+use strict;
+use warnings;
+
+BEGIN {
+ use FindBin;
+ use lib "$FindBin::Bin/../lib";
+}
+
+use List::Util qw(first);
+use Slic3r;
+use Slic3r::Test;
+
+if (!$Slic3r::have_threads) {
+ plan skip_all => "this perl is not compiled with threads";
+}
+plan tests => 2;
+
+{
+ my $print = Slic3r::Test::init_print('20mm_cube');
+ {
+ my $thread = threads->create(sub { Slic3r::thread_cleanup(); return 1; });
+ ok $thread->join, "print survives thread spawning";
+ }
+}
+
+{
+ my $thread = threads->create(sub {
+ # $print can't be inizialized outside the thread because Object->slice will
+ # modify it by removing meshes and popping layers
+ my $print = Slic3r::Test::init_print('20mm_cube');
+ Slic3r::Test::gcode($print);
+ Slic3r::thread_cleanup();
+ return 1;
+ });
+ ok $thread->join, "process print in a separate thread";
+}
+
+__END__