summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2017-07-13 19:45:54 +0000
committerJim Ingham <jingham@apple.com>2017-07-13 19:45:54 +0000
commit30bac791621d1f429fa9d6f4d212423f607378b8 (patch)
tree7a78fdb74d7ae5dc8c378f7dee0f2e6ae3fb6631
parent28a4d0b9810062c4ee291768f34b717bda4168a1 (diff)
downloadbcm5719-llvm-30bac791621d1f429fa9d6f4d212423f607378b8.tar.gz
bcm5719-llvm-30bac791621d1f429fa9d6f4d212423f607378b8.zip
Fix a deadlock in the Python interpreter vrs. SIGINT.
The interpreter gets invoked in the sigint handler to cancel long-running Python operations. That requires the interpreter lock, but that may be held by the Python operation that's getting interrupted, so the mutex needs to be recursive. <rdar://problem/33179086> llvm-svn: 307942
-rw-r--r--lldb/include/lldb/Interpreter/CommandInterpreter.h2
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index f47411079a3..73bd7d6e622 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -539,7 +539,7 @@ private:
std::string m_repeat_command; // Stores the command that will be executed for
// an empty command string.
lldb::ScriptInterpreterSP m_script_interpreter_sp;
- std::mutex m_script_interpreter_mutex;
+ std::recursive_mutex m_script_interpreter_mutex;
lldb::IOHandlerSP m_command_io_handler_sp;
char m_comment_char;
bool m_batch_command_mode;
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 075f2e7b7bd..986be7ffbf8 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2475,7 +2475,7 @@ void CommandInterpreter::HandleCommandsFromFile(
}
ScriptInterpreter *CommandInterpreter::GetScriptInterpreter(bool can_create) {
- std::lock_guard<std::mutex> locker(m_script_interpreter_mutex);
+ std::lock_guard<std::recursive_mutex> locker(m_script_interpreter_mutex);
if (!m_script_interpreter_sp) {
if (!can_create)
return nullptr;
OpenPOWER on IntegriCloud