Skip to content

Commit

Permalink
Changed to use try_lock() in BLECharacteristic.handle_gap_event
Browse files Browse the repository at this point in the history
  • Loading branch information
taks committed Nov 22, 2024
1 parent 0e3afe7 commit 829c0f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server/ble_characteristic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ impl BLECharacteristic {
let ctxt = unsafe { &*ctxt };

let mutex = unsafe { voidp_to_ref::<Mutex<Self>>(arg) };
let mut characteristic = mutex.lock();
let Some(mut characteristic) = mutex.try_lock() else {
return sys::BLE_ATT_ERR_UNLIKELY as _;
};

if unsafe { sys::ble_uuid_cmp((*ctxt.__bindgen_anon_1.chr).uuid, &characteristic.uuid.u) != 0 }
{
Expand Down

0 comments on commit 829c0f8

Please sign in to comment.