unsync3.t
来自「UNIX下perl实现代码」· T 代码 · 共 51 行
T
51 行
use Thread;$| = 1;srand($$^$^T);sub whoami { my $thread = shift; print $thread;}sub uppercase { my $count = 100; while ($count--) { my $i = int(rand(1000)); 1 while $i--; print "A"; $i = int(rand(1000)); 1 while $i--; whoami("B"); }} sub lowercase { my $count = 100; while ($count--) { my $i = int(rand(1000)); 1 while $i--; print "x"; $i = int(rand(1000)); 1 while $i--; whoami("y"); }} sub numbers { my $count = 100; while ($count--) { my $i = int(rand(1000)); 1 while $i--; print 1; $i = int(rand(1000)); 1 while $i--; whoami(2); }} new Thread \&numbers;new Thread \&uppercase;new Thread \&lowercase;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?