device-os icon indicating copy to clipboard operation
device-os copied to clipboard

[Gen4] fixes a BLE lockup circumstance

Open XuGuohui opened this issue 1 year ago • 0 comments

Problem

There is deadlock happening among multi-threads.

  1. Custom thread acquired the HAL BLE lock when calling BLE.connect(), relying on BLE event thread to release the lock, thus, suspended.
  2. User thread acquired the wiring BLE lock when calling BLE.peerCentral(), followed by trying acquiring the HAL BLE lock, thus, suspended.
  3. BLE event thread tries acquiring the wiring BLE lock when 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)

XuGuohui avatar Oct 15 '24 16:10 XuGuohui