~ubuntu-branches/ubuntu/utopic/slic3r/utopic

« back to all changes in this revision

Viewing changes to t/threads.t

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2014-06-17 01:27:26 UTC
  • Revision ID: package-import@ubuntu.com-20140617012726-2wrs4zdo251nr4vg
Tags: upstream-1.1.4+dfsg
ImportĀ upstreamĀ versionĀ 1.1.4+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use Test::More;
 
2
use strict;
 
3
use warnings;
 
4
 
 
5
BEGIN {
 
6
    use FindBin;
 
7
    use lib "$FindBin::Bin/../lib";
 
8
}
 
9
 
 
10
use List::Util qw(first);
 
11
use Slic3r;
 
12
use Slic3r::Test;
 
13
 
 
14
if (!$Slic3r::have_threads) {
 
15
    plan skip_all => "this perl is not compiled with threads";
 
16
}
 
17
plan tests => 2;
 
18
 
 
19
{
 
20
    my $print = Slic3r::Test::init_print('20mm_cube');
 
21
    {
 
22
        my $thread = threads->create(sub { Slic3r::thread_cleanup(); return 1; });
 
23
        ok $thread->join, "print survives thread spawning";
 
24
    }
 
25
}
 
26
    
 
27
{
 
28
    my $thread = threads->create(sub {
 
29
        {
 
30
            my $print = Slic3r::Test::init_print('20mm_cube');
 
31
            Slic3r::Test::gcode($print);
 
32
        }
 
33
        Slic3r::thread_cleanup();
 
34
        return 1;
 
35
    });
 
36
    ok $thread->join, "process print in a separate thread";
 
37
}
 
38
 
 
39
__END__