[all-commits] [llvm/llvm-project] 564481: [Support] ThreadPoolExecutor fixes for Windows/MinGW

Andrew Ng via All-commits all-commits at lists.llvm.org
Fri Jan 10 04:57:36 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 564481aebe18a723c9cfe9ea9ca5808771f7e9d8
      https://github.com/llvm/llvm-project/commit/564481aebe18a723c9cfe9ea9ca5808771f7e9d8
  Author: Andrew Ng <anng.sw at gmail.com>
  Date:   2020-01-10 (Fri, 10 Jan 2020)

  Changed paths:
    M lld/Common/ErrorHandler.cpp
    M llvm/lib/Support/Parallel.cpp

  Log Message:
  -----------
  [Support] ThreadPoolExecutor fixes for Windows/MinGW

Changed ThreadPoolExecutor to no longer use detached threads and instead
to join threads on destruction. This is to prevent intermittent crashing
on Windows when doing a normal full exit, e.g. via exit().

Changed ThreadPoolExecutor to be a ManagedStatic so that it can be
stopped on llvm_shutdown(). Without this, it would only be stopped in
the destructor when doing a full exit. This is required to avoid
intermittent crashing on Windows due to a race condition between the
ThreadPoolExecutor starting up threads and the process doing a fast
exit, e.g. via _exit().

The Windows crashes appear to only occur with the MSVC static runtimes
and are more frequent with the debug static runtime.

These changes also prevent intermittent deadlocks on exit with the MinGW
runtime.

Differential Revision: https://reviews.llvm.org/D70447




More information about the All-commits mailing list