Hi, I'm working with threading and i'm having a little trouble exiting the threads.
I start up two threads using CreateThread.
The program runs, now i wish to stop the threads.
So the program is something like this
load program
create thread 1
create thread 2
wait for msg
if user clicks stop
{
stop both threads
}
if user clicks go
{
start threads
}
The thread call functions r while loops.
now i want to exit the threads from outside the thread call functions. If i use exitthread it just closes the windows. if i use terminatethread, it crashses the program after 3 stops and restarts. Please help me out and let me know if there is a way for me to exit a thread and then start that thread again repeatedly. P.S. i cannot use suspend or resume thread because i need the threads to restart.
Mike
I start up two threads using CreateThread.
The program runs, now i wish to stop the threads.
So the program is something like this
load program
create thread 1
create thread 2
wait for msg
if user clicks stop
{
stop both threads
}
if user clicks go
{
start threads
}
The thread call functions r while loops.
now i want to exit the threads from outside the thread call functions. If i use exitthread it just closes the windows. if i use terminatethread, it crashses the program after 3 stops and restarts. Please help me out and let me know if there is a way for me to exit a thread and then start that thread again repeatedly. P.S. i cannot use suspend or resume thread because i need the threads to restart.
Mike