• Post Reply Bookmark Topic Watch Topic
  • New Topic

Synchronization Question

 
Vic Newman
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have multiple threads with each thread creating an instance of foo.class, what methodology would you suggest to implement method synchronization in foo besides making foo static?
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vic
If each thread has its own instance of a foo object what is there to synchronize? Or is there some class member that needs to be synchronized in the foo object?
If it is a class (static) member of class foo just create getter and setter methods in the foo class and synchronize the methods - or just part of the methods if they are large.
hope that helps
Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!