I use a table to allocate the functions ID of each function that i schedule on a Thread Pool, and then I make a PostDeferrCall(,ExitThread,) to the thread function I want to stop and the function passed as function "ExitThread" calls CmrExitPoolthreadFunction() to forces it to finish.
The function that i schedule look like that :
void ThreadFunction-Name(...)
{
int variables
safevar *savevarptr;
GetPointToSafeVar();
(make some thinks with the save var)
ReleasePointerToSafeVar();
for(;;) -> infinite loop
{
timer(time); ---> timer for n seconds
switch(variable)
{
case 1:
"make some things";
break;
case 2: "make other stuf"
break;
}
}
//end of threading function
}
how I can stop the infinite loop performed by this threading function?