threads.t 739 B

1234567891011121314151617181920212223242526272829303132333435
  1. use Test::More tests => 2;
  2. use strict;
  3. use warnings;
  4. BEGIN {
  5. use FindBin;
  6. use lib "$FindBin::Bin/../lib";
  7. use local::lib "$FindBin::Bin/../local-lib";
  8. }
  9. use List::Util qw(first);
  10. use Slic3r;
  11. use Slic3r::Test;
  12. {
  13. my $print = Slic3r::Test::init_print('20mm_cube');
  14. {
  15. my $thread = threads->create(sub { Slic3r::thread_cleanup(); return 1; });
  16. ok $thread->join, "print survives thread spawning";
  17. }
  18. }
  19. {
  20. my $thread = threads->create(sub {
  21. {
  22. my $print = Slic3r::Test::init_print('20mm_cube');
  23. Slic3r::Test::gcode($print);
  24. }
  25. Slic3r::thread_cleanup();
  26. return 1;
  27. });
  28. ok $thread->join, "process print in a separate thread";
  29. }
  30. __END__