From f75609e015cdb9eb1014b4d2e9cf9fd942bb7b20 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 29 Sep 2016 03:29:28 +0000 Subject: [PATCH] Add explanatory comment. llvm-svn: 282678 --- llvm/lib/LTO/LTOBackend.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 86ab8aac5098..c2fff4a684a7 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/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(); } -- 2.34.1