reactor-c
C Runtime for Lingua Franca
|
This file implements the enclave coordination logic. Here we are dealing with multiple mutexes. To avoid deadlocking we follow the following rules: 1) Mutexes are always locked in the following order: Enclave mutexes followed by RTI mutex. This means that we never lock an enclave mutex while holding the RTI mutex. 2) Mutexes are always unlocked in the following order: RTI mutex followed by Enclave mutex. 3) If the coordination logic might block. We unlock the enclave mutex while blocking, using a condition variable to unblock. 4) When blocking on the coordination logic, never hold the RTI mutex.