| Index: runtime/vm/os_thread_android.cc
|
| diff --git a/runtime/vm/os_thread_android.cc b/runtime/vm/os_thread_android.cc
|
| index 9b93cbe70940f5ee6a532286164279c8cfea6edb..2f51e6f2283526eb64fbefdb25f650364724bbfd 100644
|
| --- a/runtime/vm/os_thread_android.cc
|
| +++ b/runtime/vm/os_thread_android.cc
|
| @@ -3,6 +3,8 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| #include "platform/globals.h" // NOLINT
|
| +#include "platform/signal_blocker.h" // NOLINT
|
| +
|
| #if defined(TARGET_OS_ANDROID)
|
|
|
| #include "vm/os_thread.h"
|
| @@ -83,6 +85,21 @@ class ThreadStartData {
|
| };
|
|
|
|
|
| +// Spawned threads inherit their spawner's signal mask. We sometimes spawn
|
| +// threads for running Dart code from a thread that is blocking SIGPROF.
|
| +// This function explicitly unblocks SIGPROF so the profiler continues to
|
| +// sample this thread.
|
| +static void UnblockSIGPROF() {
|
| + sigset_t set;
|
| + sigemptyset(&set);
|
| + sigaddset(&set, SIGPROF);
|
| + int r = pthread_sigmask(SIG_UNBLOCK, &set, NULL);
|
| + USE(r);
|
| + ASSERT(r == 0);
|
| + ASSERT(!CHECK_IS_BLOCKING(SIGPROF));
|
| +}
|
| +
|
| +
|
| // Dispatch to the thread start function provided by the caller. This trampoline
|
| // is used to ensure that the thread is properly destroyed if the thread just
|
| // exits.
|
| @@ -99,7 +116,7 @@ static void* ThreadStart(void* data_ptr) {
|
| if (thread != NULL) {
|
| OSThread::SetCurrent(thread);
|
| thread->set_name(name);
|
| -
|
| + UnblockSIGPROF();
|
| // Call the supplied thread start function handing it its parameters.
|
| function(parameter);
|
| }
|
|
|