The acquisition and release of global_lock_mutex in acquire_global_lock and release_global_lock seems wrong to me - could you clarify?
In acquire_global_lock, the first line acquires the mutex, and commences the loop with the mutex locked. If the firmware lock is not acquired on the first pass then the mutex is released, and the loop continues with the loop released.
The function then exits with the mutex either locked or released, depending how many loops were executed - I would expect it to be consistent?
Then release_global_lock doesn't release global_lock_mutex under any circumstance - is this deliberate?
If the code is correct, would you mind writing (or suggesting to me to write) a comment explaining the code a little more?
The acquisition and release of
global_lock_mutexinacquire_global_lockandrelease_global_lockseems wrong to me - could you clarify?In
acquire_global_lock, the first line acquires the mutex, and commences the loop with the mutex locked. If the firmware lock is not acquired on the first pass then the mutex is released, and the loop continues with the loop released.The function then exits with the mutex either locked or released, depending how many loops were executed - I would expect it to be consistent?
Then
release_global_lockdoesn't releaseglobal_lock_mutexunder any circumstance - is this deliberate?If the code is correct, would you mind writing (or suggesting to me to write) a comment explaining the code a little more?