• Post Reply Bookmark Topic Watch Topic
  • New Topic

A question on Monitors.  RSS feed

 
Mahanthi Bukkapatnam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to get a list of all objects (monitors) on which a thread has acquired locks at a given point in time ?
Regards
 
Prabhjyot Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If any single thread has monitors of more than one object then it is also true that THIS thread has started executing some synchronized code inside THOSE(abc) objects and thus is not allowing other other threads to access THOSE(abc) objects.So what u have asked can simply be done by using S.O.P statements,inside the synchronized code in THOSE objects.Not aware of any specific methods/classes provided by any API.
rgds,
prabh
 
Mahanthi Bukkapatnam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prabhjyot Singh,


Well i think i had just missed the most obvious point and thanx for pointing that out. What i was trying to arrive at is to find a way to avoid deadlock. If a thread can find out the monitors locked by another thread, the first thread can take care not to try and lock on that monitor.


Anyway, i shall be working on this.

Regards

 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think it is not possible to do what you have requested.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!