[concurrency-interest] uninterruptible acquire on Semaphore?

Eric Zoerner eric.zoerner@gemstone.com
Wed, 18 Dec 2002 10:08:19 -0800


Would it not make sense and be useful to have an uninterruptible version of 
acquire on Semaphore? This method could be used in cases where you are using a 
Semaphore as a mutual exclusion lock and you are not expecting the permit to be 
held but briefly.

This way the application would not need to throw InterruptedException from all 
the methods that acquire the Semaphore permit. Alternatively if the exception is 
not propagated then the application would not have to catch the 
InterruptedException and then re-attempt to acquire the permit and then set the 
interrupted flag. This logic could be hidden in an acquireUninterruptibly method.

It could also parallel the Lock protocol where there are both lock and 
lockInterruptibly methods.