uwcms / IPMC

University of Wisconsin ZYNQ IPMC
8 stars 5 forks source link

Improve all mutex and critical section handling to be exception safe #20

Closed jtikalsky closed 5 years ago

jtikalsky commented 5 years ago

Now that we have #16 and #18, it is extremely important to consider that thrown exceptions will not call xSemaphoreGive(), xSemaphoreGiveRecursive(), or portEXIT_CRITICAL() as the stack unwinds, leaving the IPMC in a deadlock-immanent state.

Upgrade MutexLock to support non-immediate locks and add RecursiveMutexLock and CriticalSection to handle these cases as well. Then convert all existing uses of semaphores and critical sections to use these mechanisms so that the semaphores and critical sections are handled properly as the stack unwinds.