You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2026/10/18 13:00:16 UTC
(mynewt-nimble) 03/03: nimble/host: Use NPL mutex owner check if available
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 3f02afb05977ec590b1b250f64417f8b861c8d7a
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Thu Oct 8 17:46:16 2026 +0200
nimble/host: Use NPL mutex owner check if available
On non-Mynewt ports ble_hs_locked_by_cur_task() always returned 1 which
made BLE_HS_DEBUG unusable, as assertions checking that host lock is
not held were always failing. Use ble_npl_mutex_locked_by_cur_task()
if provided by NPL port.
Based on patch from PR #1562 by Deomid "rojer" Ryabkov <ro...@rojer.me>.
Assisted-by: Claude:claude-opus-5-5
---
nimble/host/src/ble_hs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/nimble/host/src/ble_hs.c b/nimble/host/src/ble_hs.c
index 9018c4d9d..6b401d507 100644
--- a/nimble/host/src/ble_hs.c
+++ b/nimble/host/src/ble_hs.c
@@ -133,6 +133,8 @@ ble_hs_locked_by_cur_task(void)
owner = ble_hs_mutex.mu.mu_owner;
return owner != NULL && owner == os_sched_get_current_task();
+#elif defined(BLE_NPL_MUTEX_LOCKED_BY_CUR_TASK)
+ return ble_npl_mutex_locked_by_cur_task(&ble_hs_mutex);
#else
return 1;
#endif