From b5fb0dee0cc6e64941dc448345f07af44f3cf8d3 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Tue, 7 May 2013 00:27:40 +0000 Subject: [PATCH] [Core] Properly stop the ThreadPoolExecutor and use the ConcRT memory allocator. llvm-svn: 181279 --- lld/include/lld/Core/Parallel.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lld/include/lld/Core/Parallel.h b/lld/include/lld/Core/Parallel.h index 7445398fa5f9..b1eb1f1922c6 100644 --- a/lld/include/lld/Core/Parallel.h +++ b/lld/include/lld/Core/Parallel.h @@ -93,7 +93,9 @@ public: } ~ThreadPoolExecutor() { + std::unique_lock lock(_mutex); _stop = true; + lock.unlock(); _cond.notify_all(); // Wait for ~Latch. } @@ -140,14 +142,14 @@ class ConcRTExecutor : public Executor { static void run(void *p) { Taskish *self = static_cast(p); self->_task(); - delete self; + concurrency::Free(self); } }; public: virtual void add(std::function func) { Concurrency::CurrentScheduler::ScheduleTask(Taskish::run, - new Taskish(func)); + new (concurrency::Alloc(sizeof(Taskish))) Taskish(func)); } };