I was surprised to see std::function related allocations showing up it a profile of lld. In the case of lld the allocations are tiny and don't really impact performance.
I am not sure if we should be trying to improve this code as it probably needs a full rewrite for better performance, but I was curious how hard it would be to remove some of the allocations.
Note that this only updated one of the executors so far.
This should probably take Latch by reference. I know lld has a bit of a different coding convention there - but it's not usually done that way in LLVM (well, it's perhaps a bit all over the shop, to be fair).