Ticket #14891 (new defect)
[MSW] thread sample deadlock
| Reported by: | ericj | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | wxMSW | Version: | 2.9-svn |
| Keywords: | thread | Cc: | |
| Blocked By: | Patch: | no | |
| Blocking: |
Description
To reproduce:
- start unmodified "thread" sample.
- select "thread -> start a new thread"
- select "thread -> stop the last spawned thread" before the thread terminates on its own (before counter reaches 10)
Program deadlocks and can only be killed through task manager.
I traced the problem down to an infinite loop in wxThreadInternal::WaitForTerminate "msw/thread.cpp". The call
result = traits->WaitForThread(m_hThread, waitMode);
(line 819 in today's SVN) always returns "WAIT_OBJECT_0 + 1", so that it never leaves the do/while loop.
I use threads often in my own projects and never had that problem. I have no idea what the sample does differently to cause this problem.
Tested with VS2003 + VS2005 under XP/32

