Deposit/withdraw lock

How to implement a single-entrant lock using AtomicInteger? A single-entrant lock which uses deposit-withdraw approach of AtomicInteger specification.

General information

ID18
Articlenone
Back-endChalice
LanguageJava
FeaturesAtomics, Locking, Witnesses
Sources
Path to example fileatomics/DWLock.java
Date2017-06-15

Statistical information

Lines of code102 lines (comments not included)
Lines of specification39 lines (38.24% of the total)
Computation time13517 milliseconds

Example code

Note, verification may take a while and has a time-out of 20 seconds.