Hello,
I need to inplement a very simple multithreading in my app. I know how to start and run a thread but when I check whether thread is alive, and if the therad has exited, the app crashes.
class TestThread: public wxThread
{
public:
void *Entry()
{
// do something
}
};
void wx_thread_testFrame::OnAbout(wxCommandEvent& event)
{
wxThread *test=new TestThread;
test->Create();
test->Run();
wxMessageBox("Thread started", "i");
if(test->IsAlive()) // if thread is still running, everything works fine
{
wxMessageBox("Click ok to kill the thread", "i");
test->Delete();
}
else // if thread has exited, IsAlive crashes the program
{
wxMessageBox("Thread ia not running", "i");
}
}