Index: runtime/vm/thread_interrupter_macos.cc |
diff --git a/runtime/vm/thread_interrupter_macos.cc b/runtime/vm/thread_interrupter_macos.cc |
index f1ff45ee5fc0ae2336e79ca5e868e70345fa9f02..59f2244d488b3e6329cf586a809de3714dcaba52 100644 |
--- a/runtime/vm/thread_interrupter_macos.cc |
+++ b/runtime/vm/thread_interrupter_macos.cc |
@@ -5,8 +5,11 @@ |
#include "platform/globals.h" |
#if defined(TARGET_OS_MACOS) |
+#include <errno.h> // NOLINT |
+ |
#include "vm/flags.h" |
#include "vm/os.h" |
+#include "vm/profiler.h" |
#include "vm/signal_handler.h" |
#include "vm/thread_interrupter.h" |
@@ -26,22 +29,17 @@ class ThreadInterrupterMacOS : public AllStatic { |
if (thread == NULL) { |
return; |
} |
- ThreadInterruptCallback callback = NULL; |
- void* callback_data = NULL; |
- if (!thread->IsThreadInterrupterEnabled(&callback, &callback_data)) { |
- return; |
- } |
+ ThreadInterruptCallback callback = Profiler::SampleThreadInterruptCallback; |
// Extract thread state. |
ucontext_t* context = reinterpret_cast<ucontext_t*>(context_); |
mcontext_t mcontext = context->uc_mcontext; |
InterruptedThreadState its; |
- its.tid = thread->id(); |
its.pc = SignalHandler::GetProgramCounter(mcontext); |
its.fp = SignalHandler::GetFramePointer(mcontext); |
its.csp = SignalHandler::GetCStackPointer(mcontext); |
its.dsp = SignalHandler::GetDartStackPointer(mcontext); |
its.lr = SignalHandler::GetLinkRegister(mcontext); |
- callback(its, callback_data); |
+ callback(thread, its); |
Ivan Posva
2015/10/28 19:31:53
Profiler::SampleThread() or some similar non-callb
Cutch
2015/10/28 19:50:33
Done.
|
} |
}; |
@@ -51,7 +49,7 @@ void ThreadInterrupter::InterruptThread(Thread* thread) { |
OS::Print("ThreadInterrupter interrupting %p\n", thread->id()); |
} |
int result = pthread_kill(thread->id(), SIGPROF); |
- ASSERT(result == 0); |
+ ASSERT((result == 0) || (result == ESRCH)); |
} |