aureliuh
asked on
How to terminate a thread in vc++
Hello,
I have a thread and in this thread I have a while. it looks something like this:
DWORD WINAPI Thread(void* lpvParam)
{
while (!Terminated)
{
// Do something
}
}
The Terminated flag will be modified from another thread. My question is that should I use Critical_Section to protect the Terminated flag?
Thank you
I have a thread and in this thread I have a while. it looks something like this:
DWORD WINAPI Thread(void* lpvParam)
{
while (!Terminated)
{
// Do something
}
}
The Terminated flag will be modified from another thread. My question is that should I use Critical_Section to protect the Terminated flag?
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
However would it really hurt you to use a critical section in terms of performance if you are really worried?