I use a boolean var to check if a thread should stop.
Is this the only way to do it? I tried to search for the topic, but found nothing helpful..Code:while(bRun){ //Do something Sleep(lInterval); }
I use a boolean var to check if a thread should stop.
Is this the only way to do it? I tried to search for the topic, but found nothing helpful..Code:while(bRun){ //Do something Sleep(lInterval); }
No, this isn't the only way. Try looking up CreateEvent, SetEvent, ResetEvent, and WaitForSingleObject on MSDN.
I am aware of the createevent, etc..
I just don't think this is the way for me..
The thread has to run continuously, only stopped when certain windows are opened.
When using CreateEvent(), you wait for the event to be set/reset.?
I have never used CreateEvent - I just know that it is another option. I really see nothing wrong with the method you are already using. What exactly is the problem, or are you just wondering if there is a better alternative?
Just wondering..