[concurrency-interest] a question regarding nested synchronized()

Paula Mangas Paula.Mangas at fct.unl.pt
Mon Feb 20 08:47:38 EST 2006


Yechiel Fefer,


( 1 ) objectA remains locked.

( 2 ) the locks are released in the opposite order that the they were made;
that means, using this kind of synchronization, you will always have
something like this:


Lock A

   Lock B

      Lock C

      Unlock C

   Unlock B

Unlock A


Best regards,

Paula Mangas



From: concurrency-interest-bounces at cs.oswego.edu
[mailto:concurrency-interest-bounces at cs.oswego.edu] On Behalf Of Yechiel
Sent: segunda-feira, 20 de Fevereiro de 2006 13:16
To: concurrency-interest at cs.oswego.edu
Subject: [concurrency-interest] a question regarding nested synchronized()



Say a Thread  does:=========== 





  my questions: 

1. is the command  objectB.wait();, which is called by the thread  ,
releasing the lock on object A too, or does objectA remains locked

   since it is not the monitor used for the wait() ?  (My guess is that
objectA remains locked) 
2. If the answer to 1. is yes,  in which order are the locks released ? 

Yechiel Fefer  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060220/fa41e4e6/attachment.html

More information about the Concurrency-interest mailing list