This repository has been archived by the owner on Nov 11, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AT client fix only: remove asyncRunningMutex in uAtClientIgnoreAsync(…
…). (#530) The function uAtClientIgnoreAsync() had a mutex, asyncRunningMutex, which it would lock while doing its work in order to guarantee that, if it were called while an asynchronous task was currently in progress, it would wait for that asynchronous event to complete before returning, ensuring that none were even partially executing. However that was a mistake: the things called by the asynchronous event will have their own mutex protection and so, for instance in the case of the cellular API and URC-related events, the following sequence could occur during shut-down of the cellular API: - task (A): calls one of the cellular API shut-down functions (uCellRemove() or uCellDeinit()), which locks the cellular API mutex gUCellPrivateMutex. - task (B): starts running an asynchronous event and so asyncRunningMutex is locked while executing it. - task (A): as part of the cellular API shutdown, calls uAtClientIgnoreAsync() which wants to lock asyncRunningMutex but is blocked as task (B) has it. - task (B): the function called by the asynchronous event is in the cellular API and so wants to lock gUCellPrivateMutex but is blocked as task (A) has it: WE ARE LOCKED. With this commit the asyncRunningMutex in uAtClientIgnoreAsync() is removed; it is up to the things being called asynchronously to provide their own mutex protection (which they do) and that will already ensure that such calls complete in an organised way; asyncRunningMutex is not actually necessary.
- Loading branch information