mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
WorkQueue#ParallelFor(): allocate lambda once per thread, not once per item
This commit is contained in:
parent
f59f361f09
commit
ba62c665aa
@ -89,10 +89,13 @@ public:
|
||||
count++;
|
||||
|
||||
EnqueueUnlocked(lock, [&items, func, offset, count, this]() {
|
||||
for (SizeType j = offset; j < offset + count; j++) {
|
||||
RunTaskFunction([&func, &items, j]() {
|
||||
func(items[j]);
|
||||
});
|
||||
SizeType j;
|
||||
TaskFunction f = [&func, &items, &j]() {
|
||||
func(items[j]);
|
||||
};
|
||||
|
||||
for (j = offset; j < offset + count; j++) {
|
||||
RunTaskFunction(f);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user