Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Unified Diff: runtime/vm/thread_interrupter_macos.cc

Issue 1412733008: Switch profiler from isolates to threads (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5a2ef9c1faeb2d3c964cdefc0552d96541275020 100644
--- a/runtime/vm/thread_interrupter_macos.cc
+++ b/runtime/vm/thread_interrupter_macos.cc
@@ -5,6 +5,8 @@
#include "platform/globals.h"
#if defined(TARGET_OS_MACOS)
+#include <errno.h> // NOLINT
+
#include "vm/flags.h"
#include "vm/os.h"
#include "vm/signal_handler.h"
@@ -27,21 +29,19 @@ class ThreadInterrupterMacOS : public AllStatic {
return;
}
ThreadInterruptCallback callback = NULL;
- void* callback_data = NULL;
- if (!thread->IsThreadInterrupterEnabled(&callback, &callback_data)) {
+ if (!thread->GetThreadInterruptCallback(&callback)) {
return;
}
// 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);
}
};
@@ -51,7 +51,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));
}

Powered by Google App Engine
This is Rietveld 408576698