This commit is contained in:
trochas
2024-12-03 16:02:42 +01:00
parent 6b323ae532
commit 5957c5e842
3 changed files with 7 additions and 3 deletions

View File

@@ -31,6 +31,8 @@ public class Client extends Thread {
} catch (InterruptedException e){
e.printStackTrace();
}
System.out.println("Clien " + Thread.currentThread().getId() + " : a pris une portion");
compartiment.servir(r);
try{
long temps_servir =new Random().nextInt(300 - 200) + 200;

View File

@@ -5,10 +5,11 @@ public class Cuisinier extends Thread {
public Cuisinier(Stand_de_cuisson stand_de_cuisson){
this.stand= stand_de_cuisson;
this.setDaemon(true);
}
public void run(){
while(true){
while(Thread.currentThread().isDaemon()){
Client client= stand.attendClient();
if(client!= null){
faire_cuire(client);

View File

@@ -2,12 +2,13 @@ public class Employe_du_buffet extends Thread{
public Compartiment[] buffet;
Employe_du_buffet(Compartiment[] buffet){
public Employe_du_buffet(Compartiment[] buffet){
this.buffet = buffet;
this.setDaemon(true);
}
public void run(){
while(true){
while(Thread.currentThread().isDaemon()){
for(int i = 0; i<buffet.length;i++){
if(buffet[i].getQuantite()<100){
System.out.println("Employe Buffer : remplie de stand " + i);