From 6e815d13a0c9ebee33da5f3b6a2ed86b8bf6bf0c Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 8 Apr 2023 18:43:36 +0200 Subject: [PATCH] Move common lock helper functions to a separate header. --- server/TracyLockHelpers.hpp | 28 ++++++++++++++++++++++++++++ server/TracyView_Locks.cpp | 16 +--------------- 2 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 server/TracyLockHelpers.hpp diff --git a/server/TracyLockHelpers.hpp b/server/TracyLockHelpers.hpp new file mode 100644 index 00000000..2aa5911a --- /dev/null +++ b/server/TracyLockHelpers.hpp @@ -0,0 +1,28 @@ +#ifndef __TRACYLOCKHELPERS_HPP__ +#define __TRACYLOCKHELPERS_HPP__ + +#include + +#include "../public/common/TracyForceInline.hpp" + +namespace tracy +{ + +static tracy_force_inline uint64_t GetThreadBit( uint8_t thread ) +{ + return uint64_t( 1 ) << thread; +} + +static tracy_force_inline bool IsThreadWaiting( uint64_t bitlist, uint64_t threadBit ) +{ + return ( bitlist & threadBit ) != 0; +} + +static tracy_force_inline bool AreOtherWaiting( uint64_t bitlist, uint64_t threadBit ) +{ + return ( bitlist & ~threadBit ) != 0; +} + +} + +#endif diff --git a/server/TracyView_Locks.cpp b/server/TracyView_Locks.cpp index 5f6a26af..db5b13fd 100644 --- a/server/TracyView_Locks.cpp +++ b/server/TracyView_Locks.cpp @@ -3,6 +3,7 @@ #include "TracyColor.hpp" #include "TracyFilesystem.hpp" #include "TracyImGui.hpp" +#include "TracyLockHelpers.hpp" #include "TracyMouse.hpp" #include "TracyPrint.hpp" #include "TracyView.hpp" @@ -12,21 +13,6 @@ namespace tracy constexpr float MinVisSize = 3; -static tracy_force_inline uint64_t GetThreadBit( uint8_t thread ) -{ - return uint64_t( 1 ) << thread; -} - -static tracy_force_inline bool IsThreadWaiting( uint64_t bitlist, uint64_t threadBit ) -{ - return ( bitlist & threadBit ) != 0; -} - -static tracy_force_inline bool AreOtherWaiting( uint64_t bitlist, uint64_t threadBit ) -{ - return ( bitlist & ~threadBit ) != 0; -} - enum class LockState { Nothing,