Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions interpreter/cling/lib/Interpreter/EnterUserCodeRAII.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define CLING_ENTERUSERCODERAII_H

#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/InterpreterAccessRAII.h"
#include "cling/Interpreter/InterpreterCallbacks.h"

namespace cling {
Expand All @@ -34,25 +35,7 @@ struct EnterUserCodeRAII {
}
};

struct LockCompilationDuringUserCodeExecutionRAII {
/// Callbacks used to un/lock.
InterpreterCallbacks* fCallbacks;
/// Info provided to UnlockCompilationDuringUserCodeExecution().
void* fStateInfo = nullptr;
LockCompilationDuringUserCodeExecutionRAII(InterpreterCallbacks* callbacks):
fCallbacks(callbacks) {
if (fCallbacks)
fStateInfo = fCallbacks->LockCompilationDuringUserCodeExecution();
}

LockCompilationDuringUserCodeExecutionRAII(Interpreter& interp):
LockCompilationDuringUserCodeExecutionRAII(interp.getCallbacks()) {}

~LockCompilationDuringUserCodeExecutionRAII() {
if (fCallbacks)
fCallbacks->UnlockCompilationDuringUserCodeExecution(fStateInfo);
}
};
using LockCompilationDuringUserCodeExecutionRAII = cling::InterpreterAccessRAII;
}

#endif // CLING_ENTERUSERCODERAII_H
2 changes: 1 addition & 1 deletion interpreter/cling/lib/Interpreter/LookupHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ namespace cling {
// the ResolvedTypedef code paths. Through that code path nothing is
// taking the ROOT/Interpreter lock and since this code can modify the
// interpreter, we do need to take lock.
LockCompilationDuringUserCodeExecutionRAII LCDUCER(*m_Interpreter);
InterpreterAccessRAII LockAccess(*m_Interpreter);

// Could trigger deserialization of decls.
Interpreter::PushTransactionRAII RAII(m_Interpreter);
Expand Down
Loading