mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
For the previous couple of months, the PID tests have been hanging. The reason that the tests have been hanging lies with the Notifier, not the PID controller. Basically, a deadlock was occuring during Notifier destruction when the notifier destructor was called while the notifier interrupt handler was being called. Because the low-level interrupt manager waits for the interrupt handler to finish executing before disabling itself, the notifier destructor would not exit until the ProcessQueue function finished. However, at the same time, the handler was attempting to lock the queueMutex before continuing; the Notifier destructor had locked the queueMutex while wrapping things up, meaning that the last run of the handler would not complete until the destructor did, resulting in a deadlock. In order to repair this, I reduced the scope of the lock on the queueMutex in the destructor so that it only locks when absolutely necessary. This should work now. This bug was likely introduced over the summer when we updated to stl mutexes and locks, which may have messed up the original lock structure. This likely did not affect any teams, as it can only occur if you are actively destroying every* Notifier object present and if the destructor happens to be called while the handler is being run. *Note: the component of the destructor causing issues only ran if the last Notifier object is being destroyed. Change-Id: I38ba4e60816a2a8d523e927c25378390a0755444