From 3e80b6173f7485edcfb66e0773924975e8509c02 Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Tue, 2 Jul 2024 16:53:38 +0100 Subject: [PATCH] bluetooth: host: bt_disable: Let threads run before aborting This means we can raise the disconnected events which are pending from `bt_conn_cleanup_all` if bt_disable is called a cooperative thread. Without this the events were not raised until bluetooth was enabled again. fixes #72721 Signed-off-by: Sean Madigan --- subsys/bluetooth/host/hci_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 30c10723e659e9..ae850f84b133ab 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -4329,6 +4329,9 @@ int bt_disable(void) disconnected_handles_reset(); #endif /* CONFIG_BT_CONN */ + /* Let threads run before aborting */ + k_yield(); + #if defined(CONFIG_BT_RECV_WORKQ_BT) /* Abort RX thread */ k_thread_abort(&bt_workq.thread);