Well now that everyone knows about our book project, we can really
let the questions fly :-)

Can anyone suggest a good code example of a Thread critical section
that's only a few lines long?  

It seems to me that in a real program you would use one of the library
classes such as monitor, mutex, thwait, or sync.

What is the preferred mechanism to handle concurrent thread access to 
variables safely?

Many thanks!

/\ndy

--
Andrew Hunt, The Pragmatic Programmers, LLC.
Innovative Object-Oriented Software Development
web:   http://www.pragmaticprogrammer.com   email: andy / pragmaticprogrammer.com
--
Our New Book: "The Pragmatic Programmer" Published by Addison-Wesley Oct 1999
              (see www.pragmaticprogrammer.com/ppbook)
--