File: 800_threads.t

package info (click to toggle)
libsereal-encoder-perl 4.005%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,980 kB
  • sloc: ansic: 8,664; perl: 5,705; sh: 25; makefile: 5
file content (40 lines) | stat: -rw-r--r-- 710 bytes parent folder | download | duplicates (4)
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
39
40
#!perl
use strict;
use warnings;
use Test::More;

BEGIN {
  use Config;
  if (! $Config{'useithreads'}) {
    print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
    exit(0);
  }
  elsif ($] < 5.008007) {
    print("1..0 # SKIP Sereal not thread safe on Perls before 5.8.7\n");
    exit(0);
  }
}
use File::Spec;
use lib File::Spec->catdir(qw(t lib));
BEGIN {
    lib->import('lib')
        if !-d 't';
}
use Sereal::TestSet qw(:all);

use Sereal::Encoder;
plan tests => 1;
use threads;
use threads::shared;

sub foo {}
SCOPE: {
    my $dat= shared_clone([undef]);
    my $enc = Sereal::Encoder->new;

    my $thr = threads->new(\&foo);
    $thr->join;
    my $encoded= $enc->encode($dat);
}

pass();