作者patterson (踩地雷啦)
看板Programming
标题Re: 请问Perl?
时间Mon Jul 24 21:23:51 2006
※ 引述《[email protected] (气息)》之铭言:
: 有没有什麽指令,
: 可以在程式执行超过一段时间後,如十分钟,
: 就自动停止执行,麻烦各位大大告知,感恩!
#------------------------------------
my $timeout = 10;
my $cid = fork;
if($cid != 0) {
sleep $timeout;
kill 1,$cid;
exit;
}
#--- your program ----
print "I like working\n" while(1);
#-----------------------------------
这样好像可以,你可以试试
不过也许会有更好的方法
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.113.70.120