You might want to look at the lock statement too.
(from MSDN)
lock ensures that one thread does not enter a critical section while another
thread is in the critical section of code. If another thread attempts to
enter a locked code, it will wait (block) until the object is released.
--
Bob Powell [MVP]
C#, System.Drawing
The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm
Read my Blog at
http://bobpowelldotnet.blogspot.com
"afatdog" <af********@yeah.net> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
How to use EnterCriticalSection and LeaveCriticalSection in C#?
How to define CRITICAL_SECTION?