Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
0
As for standard libraries, Semaphore provides all this functionality and much more. If you only want one thread in the critical section at a time check out synchronized methods orlocks. Look at the javadoc forjava.util.concurrent.locks.AbstractQueuedSynchronizer. It has an example of how to write a Mutex class
12th Mar 2017, 8:30 AM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar