[lld] r354080 - Revert "[lld] Fix elf::unlinkAsync detached thread"

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 15 09:44:42 PST 2019


On Thu, Feb 14, 2019 at 6:05 PM Rui Ueyama <ruiu at google.com> wrote:
>
> Did it broke a bot? Please include a reason to revert when you revert a commit. Thanks! Regards

No; I reverted the wrong commit.  I reverted the revert, then reverted
the correct patch.  Sitting in timeout until I can learn to `arc diff`
instead of `git llvm push` when I want to push a patch, and that `git
revert HEAD~1` is not necessarily the exact patch you want...

>
>
> On Thu, Feb 14, 2019 at 3:39 PM Nick Desaulniers via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: nickdesaulniers
>> Date: Thu Feb 14 15:39:32 2019
>> New Revision: 354080
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=354080&view=rev
>> Log:
>> Revert "[lld] Fix elf::unlinkAsync detached thread"
>>
>> This reverts commit 2694810153cf992823eb45253d26b8567424438f.
>>
>> Modified:
>>     lld/trunk/ELF/Filesystem.cpp
>>
>> Modified: lld/trunk/ELF/Filesystem.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Filesystem.cpp?rev=354080&r1=354079&r2=354080&view=diff
>> ==============================================================================
>> --- lld/trunk/ELF/Filesystem.cpp (original)
>> +++ lld/trunk/ELF/Filesystem.cpp Thu Feb 14 15:39:32 2019
>> @@ -58,26 +58,9 @@ void elf::unlinkAsync(StringRef Path) {
>>    std::error_code EC = sys::fs::openFileForRead(Path, FD);
>>    sys::fs::remove(Path);
>>
>> -  if (EC)
>> -    return;
>> -
>>    // close and therefore remove TempPath in background.
>> -  std::mutex M;
>> -  std::condition_variable CV;
>> -  bool Started = false;
>> -  std::thread([&, FD] {
>> -    {
>> -      std::lock_guard<std::mutex> L(M);
>> -      Started = true;
>> -      CV.notify_all();
>> -    }
>> -    ::close(FD);
>> -  }).detach();
>> -
>> -  // GLIBC 2.26 and earlier have race condition that crashes an entire process
>> -  // if the main thread calls exit(2) while other thread is starting up.
>> -  std::unique_lock<std::mutex> L(M);
>> -  CV.wait(L, [&] { return Started; });
>> +  if (!EC)
>> +    std::thread([=] { ::close(FD); }).detach();
>>  #endif
>>  }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



-- 
Thanks,
~Nick Desaulniers


More information about the llvm-commits mailing list