I'm new to VC++. I want a simple program or pseudo code about how the UI thread and worker thread communicates and handle events

or

a simple program for how 2 threads access a resource, say one reading a file and other writing to the file.


Please help me.