Bluetooth: BAP: BA: Replace bools with atomic
Replace the boolean values for the BAP Broadcast Assistant with an atomic value. This prevents a rare, but possible, race condition. The busy flag has been replaced with 3 atomic values which provide better granularity in error handling, and allows for some concurrent write and read requests. To describe the new behavior, the return values in the documentation has been updated, and the error handling in the API functions has improved. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
081aa2fc94
commit
ae6c20d324
3 changed files with 255 additions and 93 deletions
|
@ -326,6 +326,7 @@ static void test_bass_discover(void)
|
|||
int err;
|
||||
|
||||
printk("Discovering BASS\n");
|
||||
UNSET_FLAG(flag_discovery_complete);
|
||||
err = bt_bap_broadcast_assistant_discover(default_conn);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to discover BASS %d\n", err);
|
||||
|
@ -335,7 +336,7 @@ static void test_bass_discover(void)
|
|||
WAIT_FOR_FLAG(flag_discovery_complete);
|
||||
|
||||
/* Verify that we can discover again */
|
||||
flag_discovery_complete = false;
|
||||
UNSET_FLAG(flag_discovery_complete);
|
||||
err = bt_bap_broadcast_assistant_discover(default_conn);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to discover BASS for the second time: %d\n", err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue