Merge branch 'main' of https://gitlab2.istic.univ-rennes1.fr/trochas/tp-4-wok
This commit is contained in:
@@ -48,6 +48,7 @@ public class Client extends Thread {
|
||||
while(!restaurant.libre()){
|
||||
restaurant.wait();
|
||||
}
|
||||
System.out.println("Clien " + Thread.currentThread().getId() + " : est entré dans le restaurant");
|
||||
restaurant.ajouterClient();
|
||||
restaurant.notifyAll();
|
||||
}catch (InterruptedException e) {
|
||||
@@ -58,6 +59,7 @@ public class Client extends Thread {
|
||||
|
||||
public void manger(){
|
||||
try{
|
||||
System.out.println("Clien " + Thread.currentThread().getId() + " : mange");
|
||||
long temps_manger =new Random().nextInt(2000 - 1000) + 1000;
|
||||
Thread.sleep(temps_manger);
|
||||
}catch(InterruptedException e){
|
||||
@@ -67,6 +69,7 @@ public class Client extends Thread {
|
||||
|
||||
public void sort(){
|
||||
synchronized(restaurant){
|
||||
System.out.println("Clien " + Thread.currentThread().getId() + " : sortir");
|
||||
restaurant.diminuerClient();
|
||||
restaurant.notifyAll();
|
||||
}
|
||||
@@ -79,6 +82,7 @@ public class Client extends Thread {
|
||||
while (stand.attendClient()!= this) { //Verify s'il est meme client
|
||||
wait();
|
||||
}
|
||||
System.out.println("Clien " + Thread.currentThread().getId() + " : fait cuir son plat");
|
||||
stand.finir_cuit(this);
|
||||
}catch (InterruptedException e){
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
public class Compartiment{
|
||||
protected final int QUANTITE_MAX = 1000;
|
||||
private int quantite_courant;
|
||||
private String name;
|
||||
|
||||
Compartiment(){
|
||||
quantite_courant = 500;
|
||||
|
||||
@@ -10,6 +10,7 @@ public class Employe_du_buffet extends Thread{
|
||||
while(true){
|
||||
for(int i = 0; i<buffet.length;i++){
|
||||
if(buffet[i].getQuantite()<100){
|
||||
System.out.println("Employe Buffer : remplie de stand " + i);
|
||||
buffet[i].remplir();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user