Force inline lock operations.

This commit is contained in:
Bartosz Taudul 2017-10-06 16:33:11 +02:00
parent dcd89f894c
commit 9736be0321
2 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@
#define TracyLockable( type, varname ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() };
#define LockableBase( type ) tracy::Lockable<type>
#define LockMark( varname ) static const tracy::SourceLocation __tracy_lock_location_#varname { __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_#varname );
#define LockMark( varname ) static const tracy::SourceLocation __tracy_lock_location_##varname { __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_##varname );
#endif

View File

@ -15,7 +15,7 @@ template<class T>
class Lockable
{
public:
Lockable( const SourceLocation* srcloc )
tracy_force_inline Lockable( const SourceLocation* srcloc )
: m_id( s_lockCounter.fetch_add( 1, std::memory_order_relaxed ) )
{
Magic magic;
@ -30,7 +30,7 @@ public:
Lockable( const Lockable& ) = delete;
Lockable& operator=( const Lockable& ) = delete;
void lock()
tracy_force_inline void lock()
{
int8_t cpu;
const auto thread = GetThreadHandle();
@ -59,7 +59,7 @@ public:
}
}
void unlock()
tracy_force_inline void unlock()
{
m_lockable.unlock();
@ -74,7 +74,7 @@ public:
s_queue.enqueue_finish( token, magic );
}
bool try_lock()
tracy_force_inline bool try_lock()
{
const auto ret = m_lockable.try_lock();
if( ret )
@ -92,7 +92,7 @@ public:
return ret;
}
void Mark( const SourceLocation* srcloc )
tracy_force_inline void Mark( const SourceLocation* srcloc )
{
Magic magic;
auto& token = s_token;