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

Unified Diff: runtime/vm/message_handler.cc

Issue 1312793004: Fix NotifyPauseOnStart and NotifyPauseOnExit dead lock (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | no next file » | 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 6a473dd74033f4c6d019be2437de0c7a8ec29aa9..976c601a4b73b8ded6b3f5ec4f4f994bf098dcd3 100644
--- a/runtime/vm/message_handler.cc
+++ b/runtime/vm/message_handler.cc
@@ -242,7 +242,12 @@ void MessageHandler::TaskCallback() {
// main() function.
if (pause_on_start()) {
if (!paused_on_start_) {
+ // Temporarily drop the lock when calling out to NotifyPauseOnStart.
+ // This avoids a dead lock that can occur when this message handler
+ // tries to post a message while a message is being posted to it.
+ monitor_.Exit();
NotifyPauseOnStart();
+ monitor_.Enter();
paused_on_start_ = true;
}
HandleMessages(false, false);
@@ -278,7 +283,12 @@ void MessageHandler::TaskCallback() {
OS::PrintErr("Isolate %s paused before exiting. "
"Use the Observatory to release it.\n", name());
}
+ // Temporarily drop the lock when calling out to NotifyPauseOnExit.
+ // This avoids a dead lock that can occur when this message handler
+ // tries to post a message while a message is being posted to it.
+ monitor_.Exit();
NotifyPauseOnExit();
turnidge 2015/08/24 17:39:55 Handle this like run_end_callback as discussed off
+ monitor_.Enter();
paused_on_exit_ = true;
}
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698