Added wxThread::OnKill() and OnDelete() callbacks.

Call OnXXX() from wxThread::Kill() and Delete() respectively to allow the
thread being terminated perform some cleanup.

Closes #9046.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65882 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-10-23 14:10:12 +00:00
parent ec2c85bf79
commit df191bfe39
5 changed files with 52 additions and 0 deletions

View File

@@ -686,6 +686,8 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize)
wxThreadError wxThreadInternal::Kill()
{
m_thread->OnKill();
if ( !::TerminateThread(m_hThread, THREAD_ERROR_EXIT) )
{
wxLogSysError(_("Couldn't terminate thread"));
@@ -759,6 +761,7 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs,
Cancel();
}
threadToDelete->OnDelete();
// now wait for thread to finish
if ( wxThread::IsMain() )