Commit d210d68
committed
Thread-Safty: Add Mutex per Interpreter
Have a mutex for each interpreter instance create.
Only use the lock at writes to the AST.
Use hashmap to identify Sema & AST from individual Decl
We need to identify which interpreter a Decl belongs to, when using multiple interpreter.
We do it by checking which `clang::ASTContext` the `clang::Decl` belongs
We maintain a map: `clang::ASTContext -> Cpp::InterpreterInfo`. Using this map, we identify the correct interpreter.
Note that the mutex is stored in the InterpreterInfo class.
There are 2 usecases for this:
1. We can now lock the correct interpreter making it thread safe.
2. User of `libCppInterOp` need not set the correct active interpreter using `Cpp::ActivateInterpreter`,
this information can be retrived using the map.1 parent 33a3e7e commit d210d68
File tree
2 files changed
+301
-86
lines changed- lib/CppInterOp
- unittests/CppInterOp
2 files changed
+301
-86
lines changed
0 commit comments