How do I pass data to another thread within the same process? I'm writing in c++ for windows 7 os. Consider the following thread for example:
DWORD WINAPI MyThreadFunction(LPVOID lpParam){
while(true){
//Do the thread's job here
if(gotReturnInstruction()){
//release memory etc.
break;
}
}
return 0;
}
This thread does its job as long as some other thread tells it to return. I have the handle to the thread, which I obtain from the 'CreateThread()' function. How do I pass the message to the thread (in this case the stop instruct)?