Re: Nonblocking call may block in a mutex? Nonblocking call after poll may fail?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: anon... anon.al
Date: Friday, August 31, 2007 - 7:25 am

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
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Nonblocking call may block in a mutex? Nonblocking cal ..., anon... anon.al, (Fri Aug 31, 7:25 am)