Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why consumer thread is not starting?  RSS feed

 
raja singh kumar
Ranch Hand
Posts: 189
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know why my consumer/producer program is not working. I have a producer which uses a for loop to produce 10 values and a consumer to consume the value but after the first element is produced the program keeps running forever without any output. I dont know what is the problem. What exactly am I doing wrong? How do I fix the issue?








 
Henry Wong
author
Sheriff
Posts: 23289
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
raja singh kumar wrote:What exactly am I doing wrong? How do I fix the issue?


It would be a good idea for your producer and consumer to share the same data holder. Otherwise, there is no communication.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!