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

Unified Diff: runtime/vm/message_handler.cc

Issue 1275353005: VM thread shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge Created 5 years, 3 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/os_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/message_handler.cc
diff --git a/runtime/vm/message_handler.cc b/runtime/vm/message_handler.cc
index f832cbcb1a452de06ef7199da45fa6e94a28ec9f..ef8a71ef1c16ace0d6526e3dd56936bf2958039f 100644
--- a/runtime/vm/message_handler.cc
+++ b/runtime/vm/message_handler.cc
@@ -24,6 +24,7 @@ class MessageHandlerTask : public ThreadPool::Task {
}
virtual void Run() {
+ ASSERT(handler_ != NULL);
handler_->TaskCallback();
}
@@ -82,6 +83,7 @@ void MessageHandler::Run(ThreadPool* pool,
StartCallback start_callback,
EndCallback end_callback,
CallbackData data) {
+ bool task_running;
MonitorLocker ml(&monitor_);
if (FLAG_trace_isolates) {
OS::Print("[+] Starting message handler:\n"
@@ -94,12 +96,14 @@ void MessageHandler::Run(ThreadPool* pool,
end_callback_ = end_callback;
callback_data_ = data;
task_ = new MessageHandlerTask(this);
- pool_->Run(task_);
+ task_running = pool_->Run(task_);
+ ASSERT(task_running);
}
void MessageHandler::PostMessage(Message* message, bool before_events) {
Message::Priority saved_priority;
+ bool task_running = true;
{
MonitorLocker ml(&monitor_);
if (FLAG_trace_isolates) {
@@ -124,11 +128,13 @@ void MessageHandler::PostMessage(Message* message, bool before_events) {
}
message = NULL; // Do not access message. May have been deleted.
- if (pool_ != NULL && task_ == NULL) {
+ if ((pool_ != NULL) && (task_ == NULL)) {
task_ = new MessageHandlerTask(this);
- pool_->Run(task_);
+ task_running = pool_->Run(task_);
}
}
+ ASSERT(task_running);
+
// Invoke any custom message notification.
MessageNotify(saved_priority);
}
@@ -149,7 +155,7 @@ bool MessageHandler::HandleMessages(bool allow_normal_messages,
// If isolate() returns NULL StartIsolateScope does nothing.
StartIsolateScope start_isolate(isolate());
- // ThreadInterrupter may have gone to sleep waiting while waiting for
+ // ThreadInterrupter may have gone to sleep while waiting for
// an isolate to start handling messages.
ThreadInterrupter::WakeUp();
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/os_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698