Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about working of ReentrantLock

 
D Preethi
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Can someone tell me what I am doing wrong here? The program seems to execute eternally(and does not print DONE) though I am changing the condition of the boolean variable in the thread. Basically, I want the main thread to resume once a condition is satisfied in the thread. How do I achieve that?




Thanks in advance,
Preethi
 
Roel De Nijs
Sheriff
Posts: 9927
112
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi D Preethi,

I think this is not the most appropriate forum to ask this question, because it has nothing to do with the SCJD assignment.

Kind regards,
Roel
 
D Preethi
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roel. I have reposted this message in the Threads and Synchronization Forum.
 
Roel De Nijs
Sheriff
Posts: 9927
112
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi D,

btw this code works for me (but I have to say I don't have real experience with the new concurrent api):

With the "old" methods for concurrency, it looks like this:

Kind regards,
Roel
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic