Skip to content

Commit e02de51

Browse files
jostndchat-nordic
authored andcommitted
[nrf fromtree] samples: Bluetooth: hci_ipc: Fix issue using icbmsg in bsim
Add call to Z_SPIN_DELAY() to avoid issue in bsim where time does not progress in loop causing other threads to starve. Signed-off-by: Johan Stridkvist <[email protected]> (cherry picked from commit 50c47b0)
1 parent 8827e00 commit e02de51

File tree

1 file changed

+8
-0
lines changed
  • samples/bluetooth/hci_ipc/src

1 file changed

+8
-0
lines changed

samples/bluetooth/hci_ipc/src/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,14 @@ static void hci_ipc_send(struct net_buf *buf, bool is_fatal_err)
271271
if (is_fatal_err) {
272272
LOG_ERR("IPC service send error: %d", ret);
273273
} else {
274+
/* In the POSIX ARCH, code takes zero simulated time to execute,
275+
* so busy wait loops become infinite loops, unless we
276+
* force the loop to take a bit of time.
277+
*
278+
* This delay allows the IPC consumer to execute, thus making
279+
* it possible to send more data over IPC afterwards.
280+
*/
281+
Z_SPIN_DELAY(500);
274282
k_yield();
275283
}
276284
}

0 commit comments

Comments
 (0)