[lld] r305718 - Fix a threading bug.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 19 10:57:05 PDT 2017


On Mon, Jun 19, 2017 at 10:47 AM, Rui Ueyama via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: ruiu
> Date: Mon Jun 19 12:47:04 2017
> New Revision: 305718
>
> URL: http://llvm.org/viewvc/llvm-project?rev=305718&view=rev
> Log:
> Fix a threading bug.
>
> Modified:
>     lld/trunk/COFF/Strings.cpp
>
> Modified: lld/trunk/COFF/Strings.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Strings.cpp?rev=305718&r1=305717&r2=305718&view=diff
> ==============================================================================
> --- lld/trunk/COFF/Strings.cpp (original)
> +++ lld/trunk/COFF/Strings.cpp Mon Jun 19 12:47:04 2017
> @@ -8,6 +8,7 @@
>  //===----------------------------------------------------------------------===//
>
>  #include "Strings.h"
> +#include <mutex>
>
>  #if defined(_MSC_VER)
>  #include <Windows.h>
> @@ -21,6 +22,10 @@ using namespace llvm;
>
>  Optional<std::string> coff::demangle(StringRef S) {
>  #if defined(_MSC_VER)
> +  // UnDecorateSymbolName is not thread-safe, so we need a mutex.
> +  static std::mutex Mu;
> +  std::lock_guard<std::mutex> Lock(mu);
> +

I may be wrong here, but how this works? [case-insensitiveness, maybe]
You have `mu` and `Mu`.

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the llvm-commits mailing list