libc.t
来自「source of perl for linux application,」· T 代码 · 共 55 行
T
55 行
use strict;use warnings;BEGIN { if ($ENV{'PERL_CORE'}){ chdir 't'; unshift @INC, '../lib'; } require($ENV{PERL_CORE} ? "./test.pl" : "./t/test.pl"); use Config; if (! $Config{'useithreads'}) { skip_all(q/Perl not compiled with 'useithreads'/); } plan(11);}use ExtUtils::testlib;use_ok('threads');### Start of Testing ###my $i = 10;my $y = 20000;my %localtime;for (1..$i) { $localtime{$_} = localtime($_);};my @threads;for (1..$i) { $threads[$_] = threads->create(sub { my $arg = shift; my $localtime = $localtime{$arg}; my $error = 0; for (1..$y) { my $lt = localtime($arg); if ($localtime ne $lt) { $error++; } } return $error; }, $_);}for (1..$i) { is($threads[$_]->join(), 0, 'localtime() thread-safe');}# EOF
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?