phuongnd phuongnd - 23 days ago 10
C Question

How can I make timeout = 1 second for wait_event_timeout function?

How can I make timeout = 1 second for wait_event_timeout function?
Function :

wait_event_timeout (wq,condition,timeout);


How can I make timeout = 1 second.

And if call function like that :
wait_event_timeout(queue,flag!='n',30*HZ);


timeout =???

Answer

The function wait_event_timeout takes its timeout value in jiffies. Use the constant HZ (number of timer ticks per second) to specify time in jiffies. The expression HZ is the equivalent of one second. The expression 30 * HZ is the equivalent of 30 seconds.

wait_event_timeout (wq,condition,HZ);
Comments