[lld] r181279 - [Core] Properly stop the ThreadPoolExecutor and use the ConcRT memory allocator.
Michael J. Spencer
bigcheesegs at gmail.com
Mon May 6 17:27:40 PDT 2013
Author: mspencer
Date: Mon May 6 19:27:40 2013
New Revision: 181279
URL: http://llvm.org/viewvc/llvm-project?rev=181279&view=rev
Log:
[Core] Properly stop the ThreadPoolExecutor and use the ConcRT memory allocator.
Modified:
lld/trunk/include/lld/Core/Parallel.h
Modified: lld/trunk/include/lld/Core/Parallel.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Parallel.h?rev=181279&r1=181278&r2=181279&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Parallel.h (original)
+++ lld/trunk/include/lld/Core/Parallel.h Mon May 6 19:27:40 2013
@@ -93,7 +93,9 @@ public:
}
~ThreadPoolExecutor() {
+ std::unique_lock<std::mutex> 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<Taskish *>(p);
self->_task();
- delete self;
+ concurrency::Free(self);
}
};
public:
virtual void add(std::function<void()> func) {
Concurrency::CurrentScheduler::ScheduleTask(Taskish::run,
- new Taskish(func));
+ new (concurrency::Alloc(sizeof(Taskish))) Taskish(func));
}
};
More information about the llvm-commits
mailing list