J
[Joe]
Hi,
I have 3 questions , remark as Why ??? :
I have 2 threads that run in my application, each thread is a loop with low
level call :
While(!AutoSetEvent.WaitOne(1,true))
{
DLL_Export_GetData(…)
Do something with this data
}
Know some time I want to Abort those threads , So what I did is to create
AutoSetEvent , when I want to stop the thread I call the Set event function.
Then wait in loop until the thread died :
While(thread.IsAlive())
{
Continue;
}
In the last loop I tried to add Application.DoEvent() but this cause my
application to crash. Why ???
The big problem is sometime the thread is go out of the loop but it is still
Alive Why?????
Do any one know how to do that in deferent and elegant way ????
I have 3 questions , remark as Why ??? :
I have 2 threads that run in my application, each thread is a loop with low
level call :
While(!AutoSetEvent.WaitOne(1,true))
{
DLL_Export_GetData(…)
Do something with this data
}
Know some time I want to Abort those threads , So what I did is to create
AutoSetEvent , when I want to stop the thread I call the Set event function.
Then wait in loop until the thread died :
While(thread.IsAlive())
{
Continue;
}
In the last loop I tried to add Application.DoEvent() but this cause my
application to crash. Why ???
The big problem is sometime the thread is go out of the loop but it is still
Alive Why?????
Do any one know how to do that in deferent and elegant way ????