是否可以仅在前一个功能尚未结束且时间结束时才执行人员:
my $timeout = 10; # seconds
sub get_entities {
# do staff ...
}
get_entities();
if (time == $timeout and get_entities is not over yet) {
# do staff...
}
Run Code Online (Sandbox Code Playgroud)
你试过这个吗?
my $start = time;
get_entities();
my $duration = time - $start;
Run Code Online (Sandbox Code Playgroud)
或者你在寻找更复杂的东西?