audio: Add 'join' method to StreamWorker
This is intended for use in tests where the worker
just executes some actions and then exits by itself.
Use of 'join' instead of 'stop' ensures that the
worker goes through all actions.
Bug: 205884982
Test: atest libaudioaidlcommon_test
Change-Id: I8a9f4f0bb786ee606e3b63a9847f414119716a7d
diff --git a/audio/aidl/common/StreamWorker.cpp b/audio/aidl/common/StreamWorker.cpp
index 9bca760..dda0e4a 100644
--- a/audio/aidl/common/StreamWorker.cpp
+++ b/audio/aidl/common/StreamWorker.cpp
@@ -44,6 +44,10 @@
mWorkerStateChangeRequest = true;
}
}
+ join();
+}
+
+void ThreadController::join() {
if (mWorker.joinable()) {
mWorker.join();
}