Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

what is being Thread Safe ??????

 
sim sim
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am a bit confused over what is being Thread Safe.
Suppose I have a multi threaded program accessing a Hashtable, when thread A is accessing the hashtable, thread B can also access it and corrupt the data. Is this what is called not being Thread Safe ??
If I make the hashtable synchronized, that makes it Thread Safe, am I right ??
Thanks in advance.
Sim Sim.
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but strictly speaking only methods and blocks can be synchronized. Sun has a link on synchronizing threads. Another good link is artima.com.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!