Friday, 22 April 2016

How to protect a mutable state variable ?


If there are multiple threads accessing a mutable state variable, we can protect it by :
  1. Synchronization, while accessing the variable
  2. Make the variable immutable
  3. Don't share the variable between multiple threads

No comments:

Post a Comment

Note: only a member of this blog may post a comment.