search for: null_mutex

Displaying 1 result from an estimated 1 matches for "null_mutex".

2014 Jun 07
5
[LLVMdev] Multi-threading and mutexes in LLVM
...when you try to acquire a mutex in an app with threading disabled? If this is a compile-time parameter, the solution is simple: make an empty mutex class that satisfies the Lockable concept, and have its methods do nothing. Then typedef something like llvm::mutex to be either std::mutex or llvm::null_mutex accordingly. If this is a runtime parameter, it's more complicated, and we should ask ourselves whether or not it's necessary to avoid the overhead of acquiring an uncontended mutex in single threaded apps. For what it's worth, all reasonable STL implementations will use a lightweight...