Skip to contentSkip to conversation

How does macro time_after(unknown,known) avoid wrap around ?

KJ Lei W 1 participant 2 messages Jan 10, 2007 Kernel janitors

lore
Share & tools
lore

Lei W

author
#0 lore raw

A stupid question :(

I'm reading the LKD.There is example like this:

......

if(timeout>jiffies){
	/*not timeout*/
}else{
	/*timeout*/
}

......
This will cause wrap around,yes i know.

BUT why the macro
#define time_after(unknown,known) ((long)(unknown) - (long)(known)<0))
will not?

Stupid ?

___________________________________________________________
Mp3疯狂搜-新歌热歌高速下
http://music.yahoo.com.cn/?source=mail_mailbox_footer

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

author
#1 lore raw

A stupid question :(

I'm reading the LKD.There is example like this:

......

if(timeout>jiffies){
	/*not timeout*/
}else{
	/*timeout*/
}

......
This will cause wrap around,yes i know.

BUT why the macro
#define time_after(unknown,known) ((long)(unknown) - (long)(known)<0))
will not?

Stupid ?

___________________________________________________________
抢注雅虎免费邮箱-3.5G容量,20M附件!
http://cn.mail.yahoo.com

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors