Leaving an unlocked critical section

This tutorial demonstrates Thread Validator detecting your application incorrectly unlocking a critical section that it does not own.

Note that for your executing nativeExample your critical section addresses, thread Ids and sequence numbers will all be different. We have used the values that we experienced to write this tutorial. Substitute your own values where appropriate.

  • Launch the sample application. Click on the re-launch icon on the toolbar.
    Thread Validator relaunch icon
  • The previously launched application is started.
  • From the Test menu, choose the Leave non-entered critical section.
  • Viewing the Locks tab will show one critical section in purple. This indicates the critical sections has a thread error.
    Thread Validator leaving an unlocked critical section
  • Viewing the Per Thread Locks tab will show all application threads, one of which will each have one critical section highlighted in purple. This indicates the critical section has a thread error.
    Thread Validator leaving an unlocked critical section
  • Viewing the Current Locks tab will show two threads. Any critical sections shown will not be coloured with any error colour as the critical section was exited incorrectly and thus is not locked or waiting.
    Thread Validator leaving an unlocked critical section
  • Using the Locks tab, right click on the purple entry and choose Information about lock/wait…. A modeless dialog containing information about the lock is displayed. The information includes some text describing the error.
    Thread Validator information on critical section
  • Using the Per Thread Locks tab, right click on the purple entry and choose Show Callstack…. A modeless dialog containing the callstack for the lock is displayed.
    Thread Validator callstack for leaving the unlocked critical section
  • Close the Application using the File menu’s Exit command.
  • The various tabs will display the last known state of the critical sections and waits prior to the application finishing.
  • Any errors identified during shutdown will be added to the state for each critical section and the displays updated to reflect this.

Fully functional, free for 30 days