Re: How to create kernel semaphore that will timeout?

Matthew Wilcox (Matthew.Wilcox@genedata.com)
Tue, 12 Oct 1999 13:18:21 +0200


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?

-- 
Matthew Wilcox <willy@bofh.ai>
"Windows and MacOS are products, contrived by engineers in the service of
specific companies. Unix, by contrast, is not so much a product as it is a
painstakingly compiled oral history of the hacker subculture." - N Stephenson

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