• Post Reply Bookmark Topic Watch Topic
  • New Topic

synchronised block  RSS feed

 
nitin kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi I got a doubt in multithreading. Can I have a synchronised block inside a run( ) method. Does it mean that the objects in my block do not release the monitor until it gets executed

bye
nitin
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no reason why you can't have a synchronized block inside run(). See the sample code:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!