[concurrency-interest] Lock & semaphore

Doug Lea dl@cs.oswego.edu
Thu, 11 Sep 2003 07:58:44 -0400

> I think it would be more consistent if _both_ lock and acquire either
> threw an interrupted exception or didn't.

In Java, "locking" vs "waiting" methods have the opposite defaults:
locking isn't interruptible; waiting is. Our APIs preserve this, but
also supply the non-default versions. Because Semaphores can play both
kinds of role, choosing the default here was a judgement call, but we
chose these versions because Semaphores will probably be more commonly
used for "waiting".  No matter which way we did this, it will seem
unnatural in some contexts.