diff options
Diffstat (limited to 'src/zencore')
| -rw-r--r-- | src/zencore/include/zencore/thread.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/zencore/include/zencore/thread.h b/src/zencore/include/zencore/thread.h index 2d0ef7396..bae630db9 100644 --- a/src/zencore/include/zencore/thread.h +++ b/src/zencore/include/zencore/thread.h @@ -206,6 +206,23 @@ private: Event Complete; }; +inline void +SetAtomicMax(std::atomic_uint64_t& Max, uint64_t Value) +{ + while (true) + { + uint64_t CurrentMax = Max.load(); + if (Value <= CurrentMax) + { + return; + } + if (Max.compare_exchange_strong(CurrentMax, Value)) + { + return; + } + } +} + ZENCORE_API int GetCurrentThreadId(); ZENCORE_API void Sleep(int ms); |