Perl中的警报()相当于C?

在C for Linux中,Perl的alarm()相当于什么? AFAIK在Windows中没有本地alarmfunction,但是Perl提出了一个我并不十分好奇的解决方法。

对于那些不了解alarm : Perl报警

编辑:我实际上需要以毫秒级的精度报警。 和我可以在一个线程(在一个multithreading的应用程序)中使用的一个。

就像是:

 unsigned int alarm (unsigned int secs, unsigned int usecs) { struct itimerval old, new; new.it_interval.tv_usec = 0; new.it_interval.tv_sec = 0; // usecs should always be < 1000000 secs += usecs / 1000000; usecs = usecs % 1000000; // set the alarm timer new.it_value.tv_usec = (long int) usecs; new.it_value.tv_sec = (long int) secs; // type ITIMER_REAL for wallclock timer if (setitimer (ITIMER_REAL, &new, &old) < 0) return 0; else return old.it_value.tv_sec; } 

请参阅: http : //www.gnu.org/software/libc/manual/html_node/Setting-an-Alarm.html