mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 16:54:35 +00:00
Add proper locking.
This commit is contained in:
parent
74f692c254
commit
7bd3ce319f
@ -106,6 +106,7 @@ void View::Worker()
|
|||||||
enum { MbpsUpdateTime = 200 };
|
enum { MbpsUpdateTime = 200 };
|
||||||
if( td > MbpsUpdateTime )
|
if( td > MbpsUpdateTime )
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock( m_lock );
|
||||||
m_mbps.erase( m_mbps.begin() );
|
m_mbps.erase( m_mbps.begin() );
|
||||||
m_mbps.emplace_back( 8.f * MbpsUpdateTime * bytes / ( td * 1000 * 1000 ) );
|
m_mbps.emplace_back( 8.f * MbpsUpdateTime * bytes / ( td * 1000 * 1000 ) );
|
||||||
t0 = t1;
|
t0 = t1;
|
||||||
@ -267,6 +268,8 @@ void View::Draw()
|
|||||||
|
|
||||||
void View::DrawImpl()
|
void View::DrawImpl()
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock( m_lock );
|
||||||
|
|
||||||
// Connection window
|
// Connection window
|
||||||
{
|
{
|
||||||
const auto mbps = m_mbps.back();
|
const auto mbps = m_mbps.back();
|
||||||
|
Loading…
Reference in New Issue
Block a user