aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question about working of ReentrantLock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Question about working of ReentrantLock" Watch "Question about working of ReentrantLock" New topic
Author

Question about working of ReentrantLock

D Preethi
Ranch Hand

Joined: May 24, 2008
Posts: 68
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
Bartender

Joined: Jul 19, 2004
Posts: 4926
    
  10

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


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
D Preethi
Ranch Hand

Joined: May 24, 2008
Posts: 68
Thanks Roel. I have reposted this message in the Threads and Synchronization Forum.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4926
    
  10

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
 
 
subject: Question about working of ReentrantLock
 
Similar Threads
Current thread now owner
Producer Consumer Problem
wait method doesn't working.
Question about working of ReentrantLock
Print Odd and even number in sequence with using two threads