[lldb-dev] Replacing mutex with llvm::Mutex

Zachary Turner zturner at google.com
Thu Jun 5 14:54:59 PDT 2014

I have some patches up to LLVM currently to replace their base mutex
implementations with std::mutex and std::recursive_mutex.  Assuming those
go through, the next logical step would be to replace LLDB's mutex
implementation with llvm::Mutex.

I've had a look through the code, and the biggest feature that will be
difficult to reproduce under this implementation is that of logging
specific error messages from the pthread_mutex functions.  STL's
implementation of course uses C++ exceptions, which both LLDB and LLVM
disable at compile time.  In general, I don't expect that this will be very
problematic, because errors to lock and unlock typically indicate an
invalid use of the mutex, which shoudl be caught during development time,
and errors to try_lock() are almost always "the mutex was already locked',
in which case you only need a bool.

Before I go down this path, I want to find out if anyone has urgent need of
this logging information in a way that is not upstreamable into LLVM, or if
they can think of any other reasons I should not attempt this.

In general though, I think it would be a good idea to move more common
stuff down to LLVM and make use of it there, whenever possible.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140605/d482ddfb/attachment.html>

More information about the lldb-dev mailing list