开发者

wxwidgets how to close a thread using wxCloseEvent

开发者 https://www.devze.com 2023-03-25 17:00 出处:网络
The main program thread (derived from wxConvas) generates the thread for some complicated calculations

The main program thread (derived from wxConvas) generates the thread for some complicated calculations

When the 开发者_Go百科wxCloseEvent from user arrives I want on this event to delete the thread ,because allowing the thread to continue to work causes memory errors want to know how can I find the thread from main thread in runtime and how exactly I destroy/delete it?


You do not 'find' the thread. When you construct it, you keep it, or a pointer to it, as an attribute. When the application closes, you should overide the wxApp::OnExit () method to delete the thread by calling the method wxThread::Delete() on the stored thread attribute.

0

精彩评论

暂无评论...
验证码 换一张
取 消