summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hci/src/hci_layer.c6
-rw-r--r--osi/src/list.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/hci/src/hci_layer.c b/hci/src/hci_layer.c
index fb2bb972e..fa65e6e02 100644
--- a/hci/src/hci_layer.c
+++ b/hci/src/hci_layer.c
@@ -464,14 +464,14 @@ static void event_command_ready(fixed_queue_t *queue, UNUSED_ATTR void *context)
// Move it to the list of commands awaiting response
pthread_mutex_lock(&commands_pending_response_lock);
list_append(commands_pending_response, wait_entry);
+
+ non_repeating_timer_restart_if(command_response_timer, !list_is_empty(commands_pending_response));
pthread_mutex_unlock(&commands_pending_response_lock);
// Send it off
low_power_manager->wake_assert();
packet_fragmenter->fragment_and_dispatch(wait_entry->command);
low_power_manager->transmit_done();
-
- non_repeating_timer_restart_if(command_response_timer, !list_is_empty(commands_pending_response));
}
}
@@ -709,7 +709,9 @@ static bool filter_incoming_event(BT_HDR *packet) {
return false;
intercepted:;
+ pthread_mutex_lock(&commands_pending_response_lock);
non_repeating_timer_restart_if(command_response_timer, !list_is_empty(commands_pending_response));
+ pthread_mutex_unlock(&commands_pending_response_lock);
if (wait_entry) {
// If it has a callback, it's responsible for freeing the packet
diff --git a/osi/src/list.c b/osi/src/list.c
index 6fbb69cd7..91836318b 100644
--- a/osi/src/list.c
+++ b/osi/src/list.c
@@ -12,7 +12,7 @@ struct list_node_t {
typedef struct list_t {
list_node_t *head;
list_node_t *tail;
- size_t length;
+ volatile size_t length;
list_free_cb free_cb;
const allocator_t *allocator;
} list_t;