Skip to content

Commit af6f9cf

Browse files
jan-wassenbergcopybara-github
authored andcommitted
Further pool simplification
Remove epoch members, stateless functors Smaller code size (only 7 config combinations) Also change const pointer to ref. PiperOrigin-RevId: 808991912
1 parent 3fcc2d5 commit af6f9cf

File tree

3 files changed

+155
-201
lines changed

3 files changed

+155
-201
lines changed

hwy/contrib/thread_pool/spin.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,23 +302,23 @@ static inline SpinType DetectSpin(int disabled = 0) {
302302
return SpinType::kPause;
303303
}
304304

305-
// Calls `func(spin)` for the given `spin_type`.
306-
template <class Func>
307-
HWY_INLINE void CallWithSpin(SpinType spin_type, Func&& func) {
305+
// Calls `func(spin, args)` for the given `spin_type`.
306+
template <class Func, typename... Args>
307+
HWY_INLINE void CallWithSpin(SpinType spin_type, Func&& func, Args&&... args) {
308308
switch (spin_type) {
309309
#if HWY_ENABLE_MONITORX
310310
case SpinType::kMonitorX:
311-
func(SpinMonitorX());
311+
func(SpinMonitorX(), std::forward<Args>(args)...);
312312
break;
313313
#endif
314314
#if HWY_ENABLE_UMONITOR
315315
case SpinType::kUMonitor:
316-
func(SpinUMonitor());
316+
func(SpinUMonitor(), std::forward<Args>(args)...);
317317
break;
318318
#endif
319319
case SpinType::kPause:
320320
default:
321-
func(SpinPause());
321+
func(SpinPause(), std::forward<Args>(args)...);
322322
break;
323323
}
324324
}

0 commit comments

Comments
 (0)