Gamingphreek
Lifer
*Please don't provide any Producer-Consumer code as this is homework*
I had to create a Producer-Consumer program in Java and I just had a question regarding threads in Java in general.
I wrote my code using a Producer/Consumer that extended the Thread class which then called Synchronized methods. Outside of one specification (The main thread needs to wait for the Consumer thread to finish) the code is completely working. But I am also told that we must use our system's timer facilities to implement the producer.
We received next to no instruction on multi-threading so I had to teach it to myself. Therefore, correct me if I am wrong - From what I understand the approach I used in Java is a Timer based approach as I use wait() and notify().
Thanks for any explanation,
-Kevin
I had to create a Producer-Consumer program in Java and I just had a question regarding threads in Java in general.
I wrote my code using a Producer/Consumer that extended the Thread class which then called Synchronized methods. Outside of one specification (The main thread needs to wait for the Consumer thread to finish) the code is completely working. But I am also told that we must use our system's timer facilities to implement the producer.
We received next to no instruction on multi-threading so I had to teach it to myself. Therefore, correct me if I am wrong - From what I understand the approach I used in Java is a Timer based approach as I use wait() and notify().
Thanks for any explanation,
-Kevin