search for: getmutex

Displaying 3 results from an estimated 3 matches for "getmutex".

2018 Sep 15
4
LLVMContext: Threads and Ownership.
.... Then in the IR-compiling layer of the JIT we could have something like: // Compile finished, time to deallocate the module. // Explicit deletes used for clarity, we would use unique_ptrs in practice. auto &Ctx = Mod->getContext(); delete Mod; std::lock_guard<std::mutex> Lock(Ctx->getMutex()); if (Ctx.getNumModules()) delete Ctx; Another option would be to invert the ownership model and say that each Module shares ownership of its LLVMContext. That way LLVMContexts would be automatically deallocated when the last module using them is destructed (providing no other shared_ptrs to t...
2018 Sep 16
2
LLVMContext: Threads and Ownership.
...thing like: >> >> // Compile finished, time to deallocate the module. >> // Explicit deletes used for clarity, we would use unique_ptrs in >> practice. >> auto &Ctx = Mod->getContext(); >> delete Mod; >> std::lock_guard<std::mutex> Lock(Ctx->getMutex()); >> if (Ctx.getNumModules()) >> delete Ctx; >> >> Another option would be to invert the ownership model and say that each >> Module shares ownership of its LLVMContext. That way LLVMContexts would be >> automatically deallocated when the last module using th...
2018 Sep 16
2
LLVMContext: Threads and Ownership.
...finished, time to deallocate the module. >>>> // Explicit deletes used for clarity, we would use unique_ptrs in >>>> practice. >>>> auto &Ctx = Mod->getContext(); >>>> delete Mod; >>>> std::lock_guard<std::mutex> Lock(Ctx->getMutex()); >>>> if (Ctx.getNumModules()) >>>> delete Ctx; >>>> >>>> Another option would be to invert the ownership model and say that each >>>> Module shares ownership of its LLVMContext. That way LLVMContexts would be >>>> automat...