I think your concept is either plain wrong or really unusual, or you did not explain it very well.
You normally do not create a thread that runs one line of code and exits.
The thread function normally would look like:
function3()
{
while (!bExitThread)
{
doSomething();
}
};
You could modify this a bit:
function3()
{
while (!bExitThread)
{
if (!bSuspended)
{
doSomething();
}
else
{
Sleep(100);
}
}
}
Now you can:
1) Make thread exit cleanly by setting bExitThread to TRUE
2) Make thread "suspended" by setting bSuspended to TRUE without destroying the underlying OS thread (and you can resume it again by setting bSuspended to FALSE)