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