Move busy_wait() to asm.hpp

This commit is contained in:
Nekotekina 2020-12-18 09:47:08 +03:00
parent 908465b274
commit 4cfa9b11f3
8 changed files with 21 additions and 8 deletions

View file

@ -905,10 +905,3 @@ struct value_hash
return static_cast<std::size_t>(value) >> Shift;
}
};
// Synchronization helper (cache-friendly busy waiting)
inline void busy_wait(std::size_t cycles = 3000)
{
const u64 s = __rdtsc();
do _mm_pause(); while (__rdtsc() - s < cycles);
}