RFR: 8255582: Introduce SemaphoreLock and SemaphoreLocker

Stefan Karlsson stefank at openjdk.java.net
Thu Oct 29 10:26:52 UTC 2020


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.

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

Commit messages:
 - 8255582: Introduce SemaphoreLock and SemaphoreLocker

Changes: https://git.openjdk.java.net/jdk/pull/927/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=927&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8255582
  Stats: 59 lines in 2 files changed: 59 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/927.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/927/head:pull/927

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


More information about the hotspot-runtime-dev mailing list