BEGIN {
unless
(
$Config
{useithreads}) {
print
"1..0 # SKIP no ithreads\n"
;
exit
0;
}
my
$v
= version->parse(
$Config
{version});
if
(
$v
>=
'5.9.5'
and
$v
<
'5.10.1'
) {
print
"1..0 # SKIP threads broken in Perl_parser_dup\n"
;
exit
0;
}
if
(
$Config
{osname} eq
'openbsd'
and
$Config
{osvers} eq
'7.0'
) {
print
"1..0 # SKIP OpenBSD 7.0 threads broken?\n"
;
exit
0;
}
}
BEGIN {
@OPTS
=
qw(:mac=unique)
;
ok 1,
'began'
;
}
ok 1,
'loaded'
;
my
%seen
= ();
share(
%seen
);
my
$uu
= UUID::uuid6();
ok 1,
'got something'
;
note
$uu
;
is
substr
(
$uu
, 14, 1),
'6'
,
'its v6'
;
is
substr
(
unpack
(
"B*"
,
pack
(
"H*"
,
substr
(
$uu
, 19, 2))), 0, 2),
'10'
,
'its dce'
;
is
substr
(
unpack
(
"B*"
,
pack
(
"H*"
,
substr
(
$uu
, 24, 2))), 7, 1),
'1'
,
'mcast set'
;
my
$node
=
substr
$uu
, 24;
note
"parent: $node"
;
{
lock
%seen
; ++
$seen
{
$node
} }
note
'spawning'
;
threads->create( \
&doit
,
$_
)->
join
for
1..9;
sub
doit {
note
"in doit()"
;
my
(
$i
) =
@_
;
note
"generating $i"
;
my
$ut
= UUID::uuid6();
note
"uuid $i: $ut"
;
my
$n1
=
substr
$ut
, 24;
note
"node $i: $n1"
;
lock
%seen
;
ok !
exists
(
$seen
{
$n1
}),
"unique $i"
;
++
$seen
{
$n1
};
}
done_testing;