RFR: 8255582: Introduce SemaphoreLock and SemaphoreLocker

Per Liden pliden at openjdk.java.net
Thu Oct 29 11:13:42 UTC 2020


On Thu, 29 Oct 2020 10:01:22 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> Semaphores can be used as low-level locks, but the readability of the code using them could be better. I propose that we introduce two new classes:
> 
> SemaphoreLock - which provides the operations lock, unlock, try_lock.
> 
> SemaphoreLocker - Equivalent to MutexLocker.

For low-level locks, an alternative could be to use PlatformMutex.

-------------

PR: https://git.openjdk.java.net/jdk/pull/927


More information about the hotspot-dev mailing list