[Lldb-commits] [lldb] r251993 - Use std::list::splice in TaskPool to avoid an allocation
Tamas Berghammer via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 3 14:29:21 PST 2015
Author: tberghammer
Date: Tue Nov 3 16:29:20 2015
New Revision: 251993
URL: http://llvm.org/viewvc/llvm-project?rev=251993&view=rev
Log:
Use std::list::splice in TaskPool to avoid an allocation
Using std::list::splice to move an element from one list to an other
avoids the allocation of a new element and a move of the data.
Modified:
lldb/trunk/include/lldb/Utility/TaskPool.h
Modified: lldb/trunk/include/lldb/Utility/TaskPool.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/TaskPool.h?rev=251993&r1=251992&r2=251993&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/TaskPool.h (original)
+++ lldb/trunk/include/lldb/Utility/TaskPool.h Tue Nov 3 16:29:20 2015
@@ -153,8 +153,7 @@ TaskRunner<T>::AddTask(F&& f, Args&&...
T&& r = f(std::forward<Args>(args)...);
std::unique_lock<std::mutex> lock(this->m_mutex);
- this->m_ready.emplace_back(std::move(*it));
- this->m_pending.erase(it);
+ this->m_ready.splice(this->m_ready.end(), this->m_pending, it);
lock.unlock();
this->m_cv.notify_one();
More information about the lldb-commits
mailing list