LK8000/LK8000 — pull request #199 by brunotl (2012-01-13 22:12:37+00:00)
Title: Fix DeadLock

two different resource (GPS_INFO & startupStoreFile) use same critical section -> DeadLock

Detected In this Case :

First Thread Call Graph

MapWindow::DrawThread()
MapWindow::UpdateInfo
LockFlightData() ------> this is Loked Second
MapWindow::Zoom::UpdateMapScale()
MapWindow::Zoom::CalculateAutoZoom()
LockTaskData() -------> Dead Lock*
UnLockTaskData()

Second Thread Call Graph

CalculationThread()
DoCalculationsSlow()
DoRangeWaypointList()
LockTaskData() ------> this is Loked First
StartupStore()
LockFlightData() ------> Deadlock
UnlockLockFlightData()
UnLockTaskData()

for avoiding dead lock, two rules must be respected:

1. each shared resource must be owner of her lock
2. access the shared resource always in the same order