From 2e1c47e13551dfc592bd3d92074f3f4b69c4b6a9 Mon Sep 17 00:00:00 2001 From: mtklein Date: Thu, 12 Mar 2015 07:16:56 -0700 Subject: [PATCH] Rejigger keep-alive thread so TSAN and LSAN don't complain. BUG=skia: Review URL: https://codereview.chromium.org/1006443002 --- dm/DM.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/dm/DM.cpp b/dm/DM.cpp index 9739210..2734b75 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -518,16 +518,22 @@ static void run_enclave_and_gpu_tests(SkTArray* tasks) { // Some runs (mostly, Valgrind) are so slow that the bot framework thinks we've hung. // This prints something every once in a while so that it knows we're still working. -static void keep_alive(void*) { - for (;;) { - static const int kSec = 300; -#if defined(SK_BUILD_FOR_WIN) - Sleep(kSec * 1000); -#else - sleep(kSec); -#endif - SkDebugf("\nStill alive: doing science, reticulating splines...\n"); - } +static void start_keepalive() { + struct Loop { + static void forever(void*) { + for (;;) { + static const int kSec = 300; + #if defined(SK_BUILD_FOR_WIN) + Sleep(kSec * 1000); + #else + sleep(kSec); + #endif + SkDebugf("\nStill alive: doing science, reticulating splines...\n"); + } + } + }; + static SkThread* intentionallyLeaked = new SkThread(Loop::forever); + intentionallyLeaked->start(); } int dm_main(); @@ -539,8 +545,7 @@ int dm_main() { SkInstCountPrintLeaksOnExit(); } - SkThread keepAlive(keep_alive); // This thread will just be killed by processes shutdown. - keepAlive.start(); + start_keepalive(); gather_gold(); -- 2.7.4