Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

threads for a instance  RSS feed

 
william kane
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Is there a way in which in can query an object that is sne as a parameter to a method in my class if its being accessed by some other thread.
My scenario is like this ...
I have an object whose methods are not thread safe I want wrap this object in a proxy that will nesure that call to this object are synchronized.
Hope i have made myself clear
Thanks in advance
william
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, there's no way to tell. If an object might be accessed by multiple threads, then you should protect it. Note that all the clients would need to use your synchronized proxy.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!