Merge "PatchCommandThread: Add clang thread-safety" into udc-dev-plus-aosp am: 125e59241a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/24898129
Change-Id: Iba9085858fa87d30bff1f5a0e32ca238aae47d4f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/services/audioflinger/PatchCommandThread.h b/services/audioflinger/PatchCommandThread.h
index 092c0bc..8ca96f1 100644
--- a/services/audioflinger/PatchCommandThread.h
+++ b/services/audioflinger/PatchCommandThread.h
@@ -50,10 +50,12 @@
PatchCommandThread() : Thread(false /* canCallJava */) {}
~PatchCommandThread() override;
- void addListener(const sp<PatchCommandListener>& listener);
+ void addListener(const sp<PatchCommandListener>& listener)
+ EXCLUDES_PatchCommandThread_ListenerMutex;
- void createAudioPatch(audio_patch_handle_t handle, const IAfPatchPanel::Patch& patch);
- void releaseAudioPatch(audio_patch_handle_t handle);
+ void createAudioPatch(audio_patch_handle_t handle, const IAfPatchPanel::Patch& patch)
+ EXCLUDES_PatchCommandThread_Mutex;
+ void releaseAudioPatch(audio_patch_handle_t handle) EXCLUDES_PatchCommandThread_Mutex;
// Thread virtuals
void onFirstRef() override;
@@ -62,9 +64,8 @@
void exit();
void createAudioPatchCommand(audio_patch_handle_t handle,
- const IAfPatchPanel::Patch& patch);
- void releaseAudioPatchCommand(audio_patch_handle_t handle);
-
+ const IAfPatchPanel::Patch& patch) EXCLUDES_PatchCommandThread_Mutex;
+ void releaseAudioPatchCommand(audio_patch_handle_t handle) EXCLUDES_PatchCommandThread_Mutex;
private:
class CommandData;
@@ -98,12 +99,16 @@
audio_patch_handle_t mHandle;
};
- void sendCommand(const sp<Command>& command);
+ void sendCommand(const sp<Command>& command) EXCLUDES_PatchCommandThread_Mutex;
- audio_utils::mutex& mutex() const { return mMutex; }
- audio_utils::mutex& listenerMutex() const { return mListenerMutex; }
+ audio_utils::mutex& mutex() const RETURN_CAPABILITY(audio_utils::PatchCommandThread_Mutex) {
+ return mMutex;
+ }
+ audio_utils::mutex& listenerMutex() const
+ RETURN_CAPABILITY(audio_utils::PatchCommandThread_ListenerMutex) {
+ return mListenerMutex;
+ }
- std::string mThreadName;
mutable audio_utils::mutex mMutex;
audio_utils::condition_variable mWaitWorkCV;
std::deque<sp<Command>> mCommands GUARDED_BY(mutex()); // list of pending commands