correction de bug, normalement tout marche + rapport

This commit is contained in:
Rochas
2024-12-07 16:46:49 +01:00
parent f5cb2d1582
commit 9f6dabf199
7 changed files with 77 additions and 68 deletions

View File

@@ -10,13 +10,26 @@ public class Cuisinier extends Thread {
public void run(){
while(Thread.currentThread().isDaemon()){
Client client= stand.getClient();
if(client!= null){
faire_cuire(client);
}
attendreClient();
}
}
private void attendreClient(){
Client client = stand.getClient();
synchronized(stand){
try{
while(client==null){
stand.wait();
client= stand.getClient();
}
}
catch(InterruptedException e){
e.printStackTrace();
}
}
faire_cuire(client);
}
public void faire_cuire(Client client){
System.out.println("Cuisinier : fait cuire le plat de " + client.getNameClient()) ;
try{
@@ -27,7 +40,7 @@ public class Cuisinier extends Thread {
}
System.out.println("Cuisinier : a fini de cuire le plat de " + client.getNameClient()) ;
stand.nextClient();
stand.finir_cuit(client);
stand.finir_cuit();
}
}