aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DM.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-05-26 15:19:56 -0400
committerGravatar Mike Klein <mtklein@chromium.org>2017-05-26 20:01:00 +0000
commit2048c3ed3e3a5fb3438b0f46d98deaff1c5f5263 (patch)
tree9826827dcfae17e322da7f231956283328db15e8 /dm/DM.cpp
parent1c8408847cc626a34fc885b1c6313533d030e192 (diff)
wait for DM status thread to exit on iOS
CQ_INCLUDE_TRYBOTS=skia.primary:Test-iOS-Clang-iPadPro-GPU-GT7800-arm64-Debug,Test-iOS-Clang-iPhone6-GPU-GX6450-arm64-Debug,Test-iOS-Clang-iPhone7-GPU-GT7600-arm64-Debug Change-Id: I0e7491a6aaad08e969ceaabae49cbda718ea4be8 Reviewed-on: https://skia-review.googlesource.com/18065 Reviewed-by: Stephan Altmueller <stephana@google.com>
Diffstat (limited to 'dm/DM.cpp')
-rw-r--r--dm/DM.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 2f7dd21e34..049621038b 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -1294,9 +1294,11 @@ static void run_test(skiatest::Test test, const GrContextOptions& grCtxOptions)
DEFINE_int32(status_sec, 15, "Print status this often (and if we crash).");
+static std::atomic<bool> gStopStatusThread{false};
+
SkThread* start_status_thread() {
auto thread = new SkThread([] (void*) {
- for (;;) {
+ while (!gStopStatusThread.load()) {
print_status();
#if defined(SK_BUILD_FOR_WIN)
Sleep(FLAGS_status_sec * 1000);
@@ -1430,6 +1432,13 @@ int main(int argc, char** argv) {
SkPDFImageDumpStats();
#endif // SK_PDF_IMAGE_STATS
+ // An experiment to work around problems with libmobiledevice driving DM.
+ // Make sure the status thread has stopped completely before we exit.
+#if defined(SK_BUILD_FOR_IOS)
+ gStopStatusThread.store(true);
+ statusThread->join();
+#endif
+
print_status();
SkGraphics::PurgeAllCaches();
info("Finished!\n");