that use of sleep() in usb/kb is not a good example. it basically polls the channel at 5ms intervals with nbrecv() just to know when it should stop repeating.
a better way would be to just have a proc doing sleeps at the key repeat rate (like these 160ms) and sending ticks down a channel. and then have a alt() in this repeat proc waiting for both repeat ticks from the timer channel and for repeat on and repeat off. if nobody consumes from the timer channel, it will block and stop waking up all the time. in any case, this 5ms sleep is not really needed in usb/kb. -- cinap
