add poll_event*() interface
cover add poll_event*() interface
Hi,
The following patches, including the one below, attempt to create a new sleep interface.
In reviewing the remaining schedule_timeout() callers in the kernel, I noticed that a number of usages of this function obey this model:
/* sleep at most this long */
timeout = jiffies + some_time;
/* every interval of time, check some_event's state */
while (some_event) {
/* state to sleep in depends on the intent */
set_current_state(TASK_{UN,}INTERRUPTIBLE);
/* each iteration sleep for some_other_time */
schedule_timeout(some_other_time);
}Now, I thought to myself, this is very similar to wait_event() and co., but without wait-queues. And, thus, instead of a wait-queue being the trigger to check a condition, the some_other_time sleep going by is.
Thus, it seemed logical to add an interface to do exactly this in a nice compact way, but using msleep() and msleep_interruptible().
Patch 1/5: Adds the poll_event(), poll_event_timeout(), poll_event_interruptible() and poll_event_interruptible_timeout() interfaces.
Patch {2,3,4,5}/5: Demonstrates the utitlity of poll_event*() in various drivers.
I am more than happy to change the names of these macros, change the names of the variables, or whatever other suggestions you may have. I closely modelled the macros after wait_event*(), which should be apparently.
If this code has a decent response from KJML, I will go ahead and push it to LKML.
Thanks,
Nish
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors