> On Mon, Oct 11, 1999 at 04:00:50PM -0500, Bret Indrelee wrote:
> > What is the best way to create a kernel semaphore that will time out after
> > so many clock ticks?
> >
> > The normal kernel semaphore code doesn't provide a timeout value, if you
> > wait it is assumed to be OK to wait forever.
> >
> > One of the things I would like to do with such a semaphore is to implement a
> > timeout on DMA transfers, such that if the transfer doesn't complete in so
> > much time it will give up. I would also like to implement some simple device
> > locking using it.
>
> Why not just use a timer which unlocks the semaphore after a given period?
You can unlock a semaphore which you're holding, but there is no clean
to cancel a pending semaphore down request, which would be required for
down_trylock_timeout().
Workaround: use a wait queue and schedule_timeout.
-Andi
-- This is like TV. I don't like TV.- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/