On Aug 31, 2:20 pm, "anon... anon.al" <anon.a...@gmail.com> wrote:
Yes, it should sleep until the mutex is free.
This can be seen from a code snippet in LDD3 (Linux Device Drivers,
3rd ed.), on page 153:
http://lwn.net/images/pdf/LDD3/ch06.pdf#page=19&zoom=80,0,450
The code snippet in LDD3 does not contain the following before the while loop:
if (filp->f_flags & O_NONBLOCK) {
if (down_trylock(&dev->sem)) {
return -EAGAIN;
}
}
So a non-blocking process can also sleep (in down) if this type of
mutex is locked. It may however not block if the output-queue is full.
It cannot be b) (same reasoning as above).
But is it a) or c)...?
Regards,
Albert
-