From 8579d6c83cca2514cb5a419f368a79b9067192da Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 29 Sep 2016 03:29:28 +0000 Subject: [PATCH] Add explanatory comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282678 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/LTO/LTOBackend.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/LTO/LTOBackend.cpp b/lib/LTO/LTOBackend.cpp index 86ab8aac509..c2fff4a684a 100644 --- a/lib/LTO/LTOBackend.cpp +++ b/lib/LTO/LTOBackend.cpp @@ -253,6 +253,10 @@ void splitCodeGen(Config &C, TargetMachine *TM, AddStreamFn AddStream, std::move(BC), ThreadCount++); }, false); + + // Because the inner lambda (which runs in a worker thread) captures our local + // variables, we need to wait for the worker threads to terminate before we + // can leave the function scope. CodegenThreadPool.wait(); }