在 2015年10月23日,17:45,Arnd Bergmann arnd@arndb.de 写道:
On Friday 23 October 2015 17:12:38 Pingbo Wen wrote:
On Monday, October 19, 2015 04:58 PM, Arnd Bergmann wrote:
do_gettimeofday(&tv);
Handling the jiffies overflow is trivially done through the time_before() and time_after() helpers, like
start = jiffies; ... now = jiffies; timeout = start + HZ * timeout_usec / USEC_PER_SEC; if (time_after(now, start + timeout_jiffies) timeout(); else mod_timer(timer, start + timeout_jiffies);
The time_after function works because unsigned overflow is well-defined in C (unlike signed overflow).
Make sense, I will try this in next version.
Thanks, Pingbo