1.Perl 多线程:Threads

详情可查看:

1 perldoc threads

调用线程的方法:

 1 $thr = threads->create(FUNCTION, ARGS)
 2    #This will create a new thread that will begin execution with the
 3    #specified entry point function, and give it the *ARGS* list as
 4    #parameters. It will return the corresponding threads object, or
 5    #"undef" if thread creation failed.
 6    #FUNCTION为函数, ARGS为函数的参数
 7  
 8    # *FUNCTION* may either be the name of a function, an anonymous
 9    # subroutine, or a code ref.
10  
11         my $thr = threads->create('func_name', ...);
12         #用引号调用
13             # or
14         my $thr = threads->create(sub { ... }, ...);
15         #用匿名函数方式调用
16             # or
17         my $thr = threads->create(\&func, ...);
18         #用&的方式调用

 

转载于:https://www.cnblogs.com/perl6/p/6120007.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值