File: boolean-thr.t

package info (click to toggle)
perl 5.42.0-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 128,392 kB
  • sloc: perl: 534,963; ansic: 240,563; sh: 72,042; pascal: 6,934; xml: 2,428; yacc: 1,360; makefile: 1,197; cpp: 208; lisp: 1
file content (40 lines) | stat: -rw-r--r-- 856 bytes parent folder | download | duplicates (3)
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 Config ();
use if !$Config::Config{usethreads}, 'Test::More',
    skip_all => "This perl does not support threads";

use Test::More;
use XS::APItest;

use threads;
use threads::shared;

ok(threads->create( sub { SvIsBOOL($_[0]) }, !!0 )->join,
    'value in to thread is bool');

ok(SvIsBOOL(threads->create( sub { return !!0 } )->join),
    'value out of thread is bool');

{
    my $var = !!0;
    ok(threads->create( sub { SvIsBOOL($var) } )->join,
        'variable captured by thread is bool');
}

{
    my $sharedvar :shared = !!0;

    ok(SvIsBOOL($sharedvar),
        ':shared variable is bool outside');

    ok(threads->create( sub { SvIsBOOL($sharedvar) } )->join,
        ':shared variable is bool inside thread');
}

is(test_bool_internals(), 0, "Bulk test internal bool related APIs");

done_testing;