|
发表于 2006-12-31 18:34:04
|
显示全部楼层
Post by xiaoshao_0_0
BUGS
The current implementation of nanosleep() is based on the normal kernel
timer mechanism, which has a resolution of 1/HZ s (see time(7)).
Therefore, nanosleep() pauses always for at least the specified time,
however it can take up to 10 ms longer than specified until the process
becomes runnable again. For the same reason, the value returned in case
of a delivered signal in *rem is usually rounded to the next larger
multiple of 1/HZ s.
实际上的nanosleep并不可用,除非你是实时内核。因为,实际上,你的程序从sleep到再运行,几乎都要10ms,如此算来,计时精度极限也就是10ms了,这个在当前的内核里没有办法改进了。
这一点我也是知道的,所以我才说并不确定它的实际精度为多少。但是据同学的经验来看,即使是在多媒体这样要求实时性的应用场合中它也可以较好的满足需求。我想如果有必要,还是楼主自己实际测试一下比较好(不是说它测它的精度,而是说自己是否真的需要那么高的计时精度) |
|