You need to use OS level objects for thread synchronisation. Critical sections are the easiest to understand.

I'm probably wrong, but in this situation it doesn't seem you need OS thread synchronisation.

Code:
// In main thread...
if (!bInThread) {
	bInThread = TRUE;
	beginthread(...);     // Should check return value.
}

void ThreadProc(...) {

	...

	bInThread = FALSE;
}