File: thread-bug.t

package info (click to toggle)
libmethod-signatures-perl 20170211-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 672 kB
  • sloc: perl: 3,860; makefile: 2
file content (38 lines) | stat: -r--r--r-- 716 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /usr/bin/env perl

# eval + Data::Alias + threads == segfault
# See rt.cpan.org 82922
# This tests that we at least don't blow up on load of MS.

use strict;
use warnings;

use Config;

# threads.pm must be loaded before Test::More in order for Test::More
# to operate properly with threaded tests.
my $has_threads;
BEGIN {
    $has_threads = eval { require threads };
}
use Test::More;

plan skip_all => 'This test only relevant under threaded Perls' if !$has_threads;

use Method::Signatures;

sub worker {
    pass("Before eval");
    eval "1 + 1";
    pass("After eval");
    return 1;
}

pass("Creating thread");

my $thr = threads->create(\&worker);
$thr->join();

pass("Threads joined");

done_testing(4);