mirror of
https://github.com/Icinga/icinga2.git
synced 2026-05-28 04:12:13 -04:00
WorkQueue#ParallelFor(): allocate lambda once per thread, not once per item
This commit is contained in:
parent
f59f361f09
commit
ba62c665aa
1 changed files with 7 additions and 4 deletions
|
|
@ -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…
Reference in a new issue