QThread::exit() does not work
I tried killing my global QThread using finish() and terminate() both but none worked. What may be the problem.
I have started a global thread in one function and have also set an alarm signal . In the signal handler of this alarm signal i have tried to terminate the thread. I have checked that on timeout the control enters the signal handler but the thread.exit() statement and thread.finish()
here is the small code:
void sighand(int no)
{
bool p;
int i=0;
while(i<100)
{
if((p = a.finished())==FALSE)
{
cout<<"thread not killed\n"; //neither this is printed
a.exit();
}
else
cout<<"thread killed\n"; //nor this is printed
}
i++;
}
|