Skip to contentSkip to conversation

Semaphores with timeouts

DISCUSSION Ricardo J. Rodríguez 2 participants 3 messages Feb 14, 2008

lore
Share & tools
lore
#0 lore raw

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...

Thanks anyway,

Signature · 4 lines
Ricardo J. Rodríguez
www.deathhc.tk

#329385 | [Registered Linux User]
#1 lore raw
Quoted 7 lines · On Thu, 14 Feb 2008 01:08:28 +0100 "Ricardo J. Rodríguez"…

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

#2 lore raw

Hi Alan,

Quoted 3 lines

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"

The protocol works in adhoc wireless mode, so when I send a packet, I've to wait a while before I send it again, like TCP timeout retransmistions work.

Anyway, I've though maybe I can use SIGALRM to know when it expired and do whatever...

Signature · 4 lines
Ricardo J. Rodríguez
www.deathhc.tk

#329385 | [Registered Linux User]