summaryrefslogtreecommitdiff
path: root/audio/hal/audio_hw.h
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-09-09 09:27:50 -0700
committerGlenn Kasten <gkasten@google.com>2014-09-16 10:11:43 -0700
commit53730fd38f29dc512d5c78bac3998e3b5e22fe96 (patch)
treecea172b0eb2d24fb5926bf8558c0fb037bf6a57c /audio/hal/audio_hw.h
parent31d8c31275b48e6d9a1ffc3ac37cab641de96470 (diff)
downloadflounder-53730fd38f29dc512d5c78bac3998e3b5e22fe96.tar.gz
Change lock order to avoid priority inversions
Bug: 17129712 Change-Id: Ib0336e2b7f4c15f999d3e5984b1d87bfde884a65
Diffstat (limited to 'audio/hal/audio_hw.h')
-rw-r--r--audio/hal/audio_hw.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/audio/hal/audio_hw.h b/audio/hal/audio_hw.h
index f2b4d5e..36767c8 100644
--- a/audio/hal/audio_hw.h
+++ b/audio/hal/audio_hw.h
@@ -420,11 +420,17 @@ struct audio_device {
audio_devices_t dummybuf_thread_devices;
pthread_mutex_t dummybuf_thread_lock;
pthread_t dummybuf_thread;
+
+ pthread_mutex_t lock_inputs; /* see note below on mutex acquisition order */
};
/*
* NOTE: when multiple mutexes have to be acquired, always take the
- * stream_in or stream_out mutex first, followed by the audio_device mutex.
+ * lock_inputs, stream_in, stream_out, audio_device, then tfa9895 mutex.
+ * stream_in mutex must always be before stream_out mutex
+ * if both have to be taken (see get_echo_reference(), put_echo_reference()...)
+ * dummybuf_thread mutex is not related to the other mutexes with respect to order.
+ * lock_inputs must be held in order to either close the input stream, or prevent closure.
*/
#endif // NVIDIA_AUDIO_HW_H