• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Question about working of ReentrantLock

 
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
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic