Skip to content

Commit

Permalink
samples: Bluetooth: hci_ipc: Fix issue using icbmsg in bsim
Browse files Browse the repository at this point in the history
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 <johan.stridkvist@nordicsemi.no>
  • Loading branch information
jostn authored and carlescufi committed Oct 23, 2024
1 parent 19955f6 commit 50c47b0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions samples/bluetooth/hci_ipc/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ static void hci_ipc_send(struct net_buf *buf, bool is_fatal_err)
if (is_fatal_err) {
LOG_ERR("IPC service send error: %d", ret);
} else {
/* In the POSIX ARCH, code takes zero simulated time to execute,
* so busy wait loops become infinite loops, unless we
* force the loop to take a bit of time.
*
* This delay allows the IPC consumer to execute, thus making
* it possible to send more data over IPC afterwards.
*/
Z_SPIN_DELAY(500);
k_yield();
}
}
Expand Down

0 comments on commit 50c47b0

Please sign in to comment.