Move common lock helper functions to a separate header.

This commit is contained in:
Bartosz Taudul 2023-04-08 18:43:36 +02:00
parent 4c0e6fe3ca
commit 6e815d13a0
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 29 additions and 15 deletions

View File

@ -0,0 +1,28 @@
#ifndef __TRACYLOCKHELPERS_HPP__
#define __TRACYLOCKHELPERS_HPP__
#include <stdint.h>
#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

View File

@ -3,6 +3,7 @@
#include "TracyColor.hpp" #include "TracyColor.hpp"
#include "TracyFilesystem.hpp" #include "TracyFilesystem.hpp"
#include "TracyImGui.hpp" #include "TracyImGui.hpp"
#include "TracyLockHelpers.hpp"
#include "TracyMouse.hpp" #include "TracyMouse.hpp"
#include "TracyPrint.hpp" #include "TracyPrint.hpp"
#include "TracyView.hpp" #include "TracyView.hpp"
@ -12,21 +13,6 @@ namespace tracy
constexpr float MinVisSize = 3; 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 enum class LockState
{ {
Nothing, Nothing,