clayborg added a comment.
I had tried something similar with the thread pools when trying to parallelize
similar stuff. The solution I made was to have a global thread pool for the
entire LLDB process, but then the LLVM thread pool stuff needed to be modified
to handle different groups of threads where work could be added to a queue and
then users can wait on the queue. The queues then need to be managed by the
thread pool code. Queues could also be serial queues or concurrent queues. I
never completed the patch, but just wanted to pass along the ideas I had used.
So instead of adding everything to a separate pool, the main thread pool could
take queues. The code for your code above would look something like:
llvm::ThreadPool::Queue queue(llvm::ThreadPool::PoolType::Concurrent);
for (size_t i = 0; i < infos.size(); ++i)
queue.push(load_module_fn, i);
Debugger::GetThreadPool().wait(queue);
We could have a static function on Debugger, or just make a static function
inside of LLDB to grab the thread pool, and queue up the work for the
individual queues. Then we can have one central location for the thread pool
and anyone can throw work onto the pool with individual queues that can be
waited on separately.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122975/new/
https://reviews.llvm.org/D122975
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits