device-os
device-os copied to clipboard
[Gen4] fixes a BLE lockup circumstance
Problem
There is deadlock happening among multi-threads.
- Custom thread acquired the
HAL BLE lockwhen callingBLE.connect(), relying on BLE event thread to release the lock, thus, suspended. - User thread acquired the
wiring BLE lockwhen callingBLE.peerCentral(), followed by trying acquiring theHAL BLE lock, thus, suspended. - BLE event thread tries acquiring the
wiring BLE lockwhen invoking callback, thus, suspended.
Solution
Try acquiring BLE hal lock for query APIs.
Steps to Test
More info can be found here
References
N/A
Completeness
- [x] User is totes amazing for contributing!
- [x] Contributor has signed CLA (Info here)
- [x] Problem and Solution clearly stated
- [ ] Run unit/integration/application tests on device
- [ ] Added documentation
- [ ] Added to CHANGELOG.md after merging (add links to docs and issues)