title: Scala objects and thread safety
body: <p>I am new to Scala.</p>
  
  <p>I am trying to figure out how to ensure thread safety with functions in a Scala object (aka singleton) </p>
  
  <p>From what I have read so far, it seems that I should keep visibility to function scope (or below) and use immutable variables wherever possible. However, I have not seen examples of where thread safety is violated, so I am not sure what other precautions should be taken. </p>
  
  <p>Can someone point me to a good discussion of this issue, preferably with examples of where thread safety is violated?</p>