Changes between Initial Version and Version 1 of Ticket #18137

May 21, 2018, 12:48:43 PM (2 years ago)

There are 2 things here: first, Pause() (and also Destroy()) and TestDestroy() are pretty poor APIs that I don't recommend using at all. I don't know why do you think you need to call Pause() to stop the thread, but I'm almost certain that this is not the case, so the real solution is to just stop doing this.

Second, TestDestroy() being blocked trying to acquire the critical section just means that another thread is currently inside this critical section. I don't see which one is it, but you should be able to debug it easily by checking the owning thread field of the critical section struct. You can't have a deadlock with just a single synchronization object, so the heap critical section inside ntdll.dll doesn't explain the problem on its own. But you need to debug this further to understand what does or, alternatively, reproduce the problem with minimal changes in the thread sample. Unless you can do it, there doesn't seem to be any reasons to believe that the problem is really in wxThread code rather than in your application and I can't debug the latter, sorry.


  • Ticket #18137

    • Property Status changed from new to closed
    • Property Resolution changed from to invalid
  • Ticket #18137 – Description

    initial v1  
    2626        ntdll.dll!RtlpAllocateHeap()    Unknown
    2727        ntdll.dll!RtlAllocateHeap()     Unknown
    28         ntdll.dll!RtlDebugAllocateHeap
    29 ()      Unknown
     28        ntdll.dll!RtlDebugAllocateHeap()        Unknown
    3029        ntdll.dll!RtlpAllocateHeap()    Unknown
    3130        ntdll.dll!RtlAllocateHeap()     Unknown
    3231        ntdll.dll!RtlpAddDebugInfoToCriticalSection()   Unknown
    3332        ntdll.dll!RtlpWaitOnCriticalSection()   Unknown
    34 >       ntdll.dll!RtlpEnterCriticalSectionContended
    35 ()      Unknown
     33>       ntdll.dll!RtlpEnterCriticalSectionContended()   Unknown
    3634        graph64.exe!wxCriticalSection::Enter() Line 165 C++
    3735        graph64.exe!wxCriticalSectionLocker::wxCriticalSectionLocker(wxCriticalSection & cs) Line 308   C++
    4341        msvcr120d.dll!_callthreadstartex() Line 376     C
    4442        msvcr120d.dll!_threadstartex(void * ptd) Line 359       C
    45         kernel32.dll!BaseThreadInitThunk
    46 ()      Unknown
    47         ntdll.dll!RtlUserThreadStart
    48 ()      Unknown
     43        kernel32.dll!BaseThreadInitThunk()      Unknown
     44        ntdll.dll!RtlUserThreadStart()  Unknown
    5147[2] Call stack of the main thread:
    52         ntdll.dll!NtWaitForSingleObject
    53 ()      Unknown
     48        ntdll.dll!NtWaitForSingleObject()       Unknown
    5449        ntdll.dll!RtlpWaitOnCriticalSection()   Unknown
    55         ntdll.dll!RtlpEnterCriticalSectionContended
    56 ()      Unknown
     50        ntdll.dll!RtlpEnterCriticalSectionContended()   Unknown
    5751        ntdll.dll!RtlValidateHeap()     Unknown
    58         KernelBase.dll!HeapValidate
    59 ()      Unknown
     52        KernelBase.dll!HeapValidate()   Unknown
    6053        msvcr120d.dll!_CrtIsValidHeapPointer(const void * pUserData) Line 2034  C++
    6154        msvcr120d.dll!_free_dbg_nolock(void * pUserData, int nBlockUse) Line 1322       C++