multithreading - Perl崩溃: Wrong use of glob in threads?

标签 multithreading perl glob

以下脚本在perl 5.16中崩溃。在线程中使用glob()有什么问题吗?

use strict;
use warnings;
use 5.010;

use threads; 

sub f { 
    my $no = shift; 
    my @arr = glob("*"); 
    say "thread $no: ", scalar(@arr); 
} 

foreach my $tno (1..5) { 
    my $thr = threads->create(\&f, $tno); 
    $thr->join(); 
}

它打印
thread 1: 33

然后由于段错误(MacOS)或访问冲突(Windows 7)而崩溃。
经过v5.16.2 on Mac OSX (darwin-thread-multi-2level)ActivePerl on Windows 7 64bit (v5.16.3 built for MSWin32-x86-multi-thread)测试。

最佳答案

这是bug in perl,我在fixed中一直是5.18.2

关于multithreading - Perl崩溃: Wrong use of glob in threads?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23629632/

相关文章:

java - 合作调度与抢占式调度?

algorithm - 显式包名称和屏蔽同一语句中的早期声明

c++ - 为什么第一次调用 readline() 会减慢对 fnmatch() 的所有后续调用?

perl - Perl 管道中的可编程参数

正则表达式模式 - 忽略空格、换行符、制表符等

linux - Linux 终端中的文件 Glob 模式

python - 将许多 txt/csv 文件编译成单个数据框,并将文件名添加为列

python - Eventlet+Gunicorn 工作线程包含哪些内容?

java - 多线程 MVC 用多个独立仪表重新创建平面仪表板

c++ - 在 linux 平台上用 c/c++ 打印进程的所有线程堆栈跟踪