Reputation: 21321
Within my device driver, I am using wait_event_interruptible_timeout
. How can I tell if a timeout has occurred? The macro only returns errorcode on interrupts but timeout is not an interrupt so "0" is returned.
Edit: not sure on how to tell if timeout occurred, but condition
wont be set, so that sounds like the answer.
Upvotes: 3
Views: 2649
Reputation: 7864
I ran into the same confusing issue a couple of weeks ago after reading the description of that function in Linux Device Drivers, Third Edition. Upon reading the comments for the various wait functions in a current kernel source tree, however, I found that the API has changed since the book was published. Newer kernels (at least 2.6.34+ and probably quite a bit further back than that), return the remaining number of jiffies to the timeout instead of an error code. So, a zero return value indicates the timeout occurred and any non-zero value should indicate a successful wakeup via the event condition. The comments in include/linux/wait.h
provide a good description of the new API.
Upvotes: 4