I still don't get it. The moment I issue a CreathThread command control will pass over to the thread, where I have put a sleep function of say 10 minutes. In my main function, immediately after this CreateThread command, I have given a WriteFile command to write to the serial port. Now, will this write be executed after the sleep period of 10 minutes or before that?
Think of the two threads as if they are two completly different programs. They are executed independently of each other. So the Sleep() in one thread will be executed independently of the WriteFile() in the other thread.
On a side note, if I have a thread which reads an input from the serial port, is there a way to pass this input back to the main thread, while still ensuring that this thread continues monitoring for any other input?
Yes -- use global variables. All threads access the same global space. But you have to be careful to include thread synchonization techniques to prevent one thread from writing to the global variable at the same time that another thread tries to read or write to it. The simplest way to do this is with system mutex. See MSDN for CreateMutex() or google for examples.