(2.0.36) safe way to test semaphore

Pascal A. Dupuis (dupuis@lei.ucl.ac.be)
Wed, 10 Feb 1999 17:14:52 +0100 (CET)


Hello,
I'm updating a device driver written for 2.0.36, and was wondering about a
safe way to test semaphore (kernel semaphore, not SYSV shared memory,
which also contains semaphores).

Basically my problem is :
process A is called, and do a down(&sem). After a second call to process
A, the semaphore will be released.
process B is called when semaphore is down (it access the same data
structures as process A). It should not wait for the semaphore to be released,
but should deliver immediatly an error message. In process B, how could I
detect is the semaphore is currently "hold" by some other process ?

Thanks in advance

Pascal A. Dupuis

-- 
linux : un noyau
windows : des pépins

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