title: Delphi threading - which parts of code need to be protected/synchronized?
body: <p>so far I thought that any operation done on "shared" object (common for multiple threads) must be protected with "synchronize", no matter what. Apparently, I was wrong - in the code I'm studying recently there are plenty of classes (thread-safe ones, as the Author claims) and only one of them uses Critical Section for almost every method.</p>
  
  <p>How do I find what parts / methods of my code needs to be protected with CriticalSection (or any other method) and which not?</p>
  
  <p>So far I haven't stumbled upon any interesting explanation / article / blog note, all google results are:</p>
  
  <p>a) examples of synchronization between thread and the GUI. From simple progressbar to most complex, but still the lesson is obvious: each time you access / modify the property of GUI component, do that in "Synchronize". But nothing more.</p>
  
  <p>b) articles explaining Critical Sections, Mutexes etc. Just a different approaches of protection/synchronization.</p>
  
  <p>c) Examples of very very simple thread-safe classes (thread safe stack or list) - they all do the same - implement lock / unlock methods which do enter/leave critical section and return the actual stack/list pointer on locking.</p>
  
  <p>Now I'm looking for explanation <strong>which parts of code should be protected</strong>.</p>
  
  <p>could be in form of code ;) but please don't provide me with one more "using Synchronize to update progressbar" ... ;)</p>
  
  <p>thank you!</p>