Commit eb00c381 authored by Gabriele Civitarese's avatar Gabriele Civitarese

improved example

parent 9a158211
......@@ -13,7 +13,7 @@ public class Semaphore {
public synchronized void enter() {
System.out.println("" + threadsIn + " in the critical region...");
//quando abbiamo raggiunto il numero massimo di thread, chi vuole entrare aspetta
if (threadsIn >= maxNumber) {
while (threadsIn >= maxNumber) {
try {this.wait();}
catch(InterruptedException ie) {ie.printStackTrace();}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment