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 { |