Re: Semaphores with timeouts

From: Alan Cox
Date: Wed Feb 13 2008 - 19:26:24 EST


On Thu, 14 Feb 2008 01:08:28 +0100
"Ricardo J. RodrÃguez" <ricardo.rdez@xxxxxxxxx> wrote:

> Hi everybody,
> I'm developing a driver to support a new protocol on the kernel 2.6.x,
> a real time communication protocol used in robotic fields. Skipping
> the intro: I need to know if there is any function in the kernel to
> get the process sleeping, as down_interruptible(...), but with
> timeouts, I mean, I want the process to wake up if no signal is
> detected in a while...

The Unix world normally expects rather different behaviour

With O_NDELAY set -> no delay but -EAGAIN
Normal -> delay until error or completes or EOF

and the use of poll/select to wait until the event can be issued and is
going to complete. Hence the lack of a mutex_lock_interruptible_timeout()


It's certainly possible to add one but the first question would be "why
do you need it - what sort of API are you trying to build"

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/