wxwidgets如何使用wxCloseEvent关闭线程
主程序线程(派生自wxConvas)生成用于一些复杂计算的线程
当来自用户的wxCloseEvent到达时我想在此事件上删除线程,因为允许线程继续工作会导致内存错误 想知道如何在运行时从主线程中找到线程以及如何销毁/删除它?
The main program thread (derived from wxConvas) generates the thread for some complicated calculations
When the 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有“找到”线程。当您构造它时,您将它或指向它的指针保留为属性。当应用程序关闭时,您应该覆盖 wxApp::OnExit
() 方法通过调用存储的线程属性上的 wxThread::Delete() 方法来删除线程。
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.