spin_wait_hook.h 791 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include <library/cpp/yt/cpu_clock/clock.h>
  3. #include <library/cpp/yt/misc/enum.h>
  4. #include <util/system/src_location.h>
  5. namespace NYT::NThreading {
  6. ////////////////////////////////////////////////////////////////////////////////
  7. DEFINE_ENUM(ESpinLockActivityKind,
  8. (Read)
  9. (Write)
  10. (ReadWrite)
  11. );
  12. using TSpinWaitSlowPathHook = void(*)(
  13. TCpuDuration cpuDelay,
  14. const ::TSourceLocation& location,
  15. ESpinLockActivityKind activityKind);
  16. void RegisterSpinWaitSlowPathHook(TSpinWaitSlowPathHook hook);
  17. void InvokeSpinWaitSlowPathHooks(
  18. TCpuDuration cpuDelay,
  19. const ::TSourceLocation& location,
  20. ESpinLockActivityKind activityKind);
  21. ////////////////////////////////////////////////////////////////////////////////
  22. } // namespace NYT::NThreading