[LLVMdev] [PATCH] Replace the Execution Engine's mutex with std::recursive_mutex

Chandler Carruth chandlerc at google.com
Fri Jun 20 17:45:08 PDT 2014


On Fri, Jun 20, 2014 at 7:39 PM, Vadim Chugunov <vadimcn at gmail.com> wrote:

> I suppose there's also an option #3: "declare that LLVM only supports the
> threads-posix flavor".   As long as configure script gives a clear error
> message...
>
> It should be noted, though, that MinGW's pthreads mutexes are likely to
> perform worse than LLVM's home-grown ones: http://sourceforge.net/p/mingw
> -w64/bugs/344/


FWIW, I *very strongly* prefer this option.

We are already seeing an increasing interest in using LLVM in multithreaded
contexts at least, and I have a concrete need to add multithreaded support
to LLVM. It would be really, really terrible to be unable to use extremely
basic and standardized primitives for this such as std::mutex and
std::call_once.

I don't really care that MinGW's mutexes would be slow. The current usage
patterns of LLVM don't put them in the critical path, and in the future it
seems like there has to be a non-terrible way of implementing MinGW's
standard library without such sorrow. And ultimately, this is just a MinGW
bug. It is hardly the only one that makes this platform somewhat suboptimal.


The standard library std::mutex and std::call_once implementations are
going to get better and more widely available. It seems a mistake to
continually burden ourselves with coping with bad instances.

My 2-cents.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140621/e06f1f34/attachment.html>


More information about the llvm-dev mailing list