kathyayini
Programmer
i am using following code to exit the thread.
i am calling dll through one exe. on running the exe, one dialog box will appear and user has to click ok to call the dll. The parameters will be passed to the dll and dll will create 3 to 4 thread.On failure of any threads execution i will kill all the threads. the problem is it is killing the dialog thread also. the code is:
creating the threads in loop.
for(IThreadCount=0;IThreadCount<IThreads;IThreadCount++)
{
hThreadHandle[IThreadCount] = CreateThread(NULL,0,run_thread,(LPVOID)&info[IThreadCount],0,&dwThreadId[IThreadCount]);
SetThreadPriority(hThreadHandle[IThreadCount],THREAD_PRIORITY_HIGHEST);
}
This code is to kill all the thread on failure of any one thread.
if(fail_flag>0)
{
for (IThreadCount=0;IThreadCount<IThreads;IThreadCount++)
{
GetExitCodeThread (hThreadHandle[IThreadCount],&ExitStatus);
if(ExitStatus != 0)
{
ExitThread(ExitStatus);
}
}
return FALSE;
}
else
{
return TRUE;
}
waiting for the reply
i am calling dll through one exe. on running the exe, one dialog box will appear and user has to click ok to call the dll. The parameters will be passed to the dll and dll will create 3 to 4 thread.On failure of any threads execution i will kill all the threads. the problem is it is killing the dialog thread also. the code is:
creating the threads in loop.
for(IThreadCount=0;IThreadCount<IThreads;IThreadCount++)
{
hThreadHandle[IThreadCount] = CreateThread(NULL,0,run_thread,(LPVOID)&info[IThreadCount],0,&dwThreadId[IThreadCount]);
SetThreadPriority(hThreadHandle[IThreadCount],THREAD_PRIORITY_HIGHEST);
}
This code is to kill all the thread on failure of any one thread.
if(fail_flag>0)
{
for (IThreadCount=0;IThreadCount<IThreads;IThreadCount++)
{
GetExitCodeThread (hThreadHandle[IThreadCount],&ExitStatus);
if(ExitStatus != 0)
{
ExitThread(ExitStatus);
}
}
return FALSE;
}
else
{
return TRUE;
}
waiting for the reply