On 04/06/2014, Philip Guenther <guent...@gmail.com> wrote: > The only reason to care whether another kernel thread had made it far > enough into tlseep as to be on a sleep queue is if it's calling wakeup() > on that thread's wait channel, but you MUST use some sort of lock to > protect that shared condition that the tsleeping thread is waiting for, > period. For tsleep(), the involved lock is the kernel lock (aka "big > lock"), while for msleep() it's the passed mutex.
Would a rwlock do? The sender and recver operate asynchronously, so the sender needs to hold a lock while sending and release it when asleep, but it can't be a mutex as the send operation may sleep, so I used requ.ready as the lock, but a rwlock seems appropriate.