This commit is contained in:
Minh VU
2024-12-03 15:46:47 +01:00
parent 1b7ad1b32f
commit 13fd189dc7
4 changed files with 35 additions and 10 deletions

View File

@@ -26,7 +26,7 @@ public class Client extends Thread {
int r =new Random().nextInt(MAX_PORTION);
try{
while(r > compartiment.getQuantite()){
this.wait();
compartiment.wait();
}
} catch (InterruptedException e){
e.printStackTrace();
@@ -46,7 +46,7 @@ public class Client extends Thread {
synchronized(restaurant){
try{
while(!restaurant.libre()){
this.wait();
restaurant.wait();
}
restaurant.ajouterClient();
restaurant.notifyAll();