TD1: Set values to trigger a deadlock.
[TD_SR.git] / TD1 / exo3 / BufferCirc.java
index 1c13e54baffc0acb926b717c5d66f5bec8fddc37..68f1f1f9fd922c1eab10fcf1d1f52a336156c605 100644 (file)
@@ -32,6 +32,9 @@ public class BufferCirc {
        public synchronized void depose(Object obj) {\r
                while(isFull()) {\r
                        try {\r
+                               System.out.println("Buffer is full: " + Thread.currentThread().getName()\r
+                                    + " is waiting, size: " + nbObj);\r
+\r
                                wait();\r
                        }\r
                        catch (InterruptedException e) {}\r
@@ -47,6 +50,8 @@ public class BufferCirc {
        public synchronized Object preleve() {\r
                while(isEmpty()) {\r
                        try {\r
+                               System.out.println("Buffer is empty: " + Thread.currentThread().getName()\r
+                                    + " is waiting, size: " + nbObj);\r
                                wait();\r
                        }\r
                        catch (InterruptedException e) {}\r