| 44 | // InvokeWithThreadId handles passing thread_id to the function |
| 45 | template <typename F, typename... Args> |
| 46 | void InvokeWithThreadId(int thread_id, F&& function, Args&&... args) { |
| 47 | constexpr bool kPassThreadId = std::is_invocable_v<F, int, Args...>; |
| 48 | |
| 49 | if constexpr (kPassThreadId) { |
| 50 | function(thread_id, std::forward<Args>(args)...); |
| 51 | } else { |
| 52 | function(std::forward<Args>(args)...); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // InvokeOnSegment either runs a loop over segment indices or passes it to the |
| 57 | // function |
no test coverage detected