TD1: fix thread name setting. master
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 8 Jun 2018 18:19:17 +0000 (20:19 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 8 Jun 2018 18:19:17 +0000 (20:19 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TD1/exo3/Consommateur.java
TD1/exo3/Producteur.java

index a857e7eee42e94c58adc7134c8dc5d0a0796b5b0..128249940e41c1ef71f8521eed41b23bba1bcdcd 100644 (file)
@@ -9,13 +9,13 @@ public class Consommateur implements Runnable {
                buffer = b;
        }
 
-       public Consommateur(BufferCirc b, String name) {
+       public Consommateur(BufferCirc b, Thread th, String name) {
                buffer = b;
-               setThName(name);
+               setThName(th, name);
        }
 
-       public void setThName(String name) {
-               Thread.currentThread().setName(name);
+       public void setThName(Thread th, String name) {
+               th.setName(name);
        }
 
        public void run() {
index 732fafa22097c4a0e83b0cec23984c0b1f1a5da2..5e09d5062cf9ebb1cad47860e89dfe53aa59ec58 100644 (file)
@@ -11,13 +11,13 @@ public class Producteur implements Runnable {
                buffer = b;
        }
 
-       public Producteur(BufferCirc b, String name) {
+       public Producteur(BufferCirc b, Thread th, String name) {
                buffer = b;
-               setThName(name);
+               setThName(th, name);
        }
 
-       public void setThName(String name) {
-               Thread.currentThread().setName(name);
+       public void setThName(Thread th, String name) {
+               th.setName(name);
        }
 
        public void run() {