Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion indra/llcommon/llthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class LL_COMMON_API LLThread
// Called from MAIN THREAD.
void pause();
void unpause();
bool isPaused() { return isStopped() || mPaused; }
bool isPaused() const { return isStopped() || mPaused; }

// Cause the thread to wake up and check its condition
void wake();
Expand Down
24 changes: 12 additions & 12 deletions indra/newview/llappviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5676,9 +5676,9 @@ void LLAppViewer::forceErrorThreadCrash()
thread->start();
}

void LLAppViewer::initMainloopTimeout(const std::string& state, F32 secs)
void LLAppViewer::initMainloopTimeout(std::string_view state, F32 secs)
{
if(!mMainloopTimeout)
if (!mMainloopTimeout)
{
mMainloopTimeout = new LLWatchdogTimeout();
resumeMainloopTimeout(state, secs);
Expand All @@ -5687,20 +5687,20 @@ void LLAppViewer::initMainloopTimeout(const std::string& state, F32 secs)

void LLAppViewer::destroyMainloopTimeout()
{
if(mMainloopTimeout)
if (mMainloopTimeout)
{
delete mMainloopTimeout;
mMainloopTimeout = NULL;
mMainloopTimeout = nullptr;
}
}

void LLAppViewer::resumeMainloopTimeout(const std::string& state, F32 secs)
void LLAppViewer::resumeMainloopTimeout(std::string_view state, F32 secs)
{
if(mMainloopTimeout)
if (mMainloopTimeout)
{
if(secs < 0.0f)
if (secs < 0.0f)
{
static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60);
static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60.f);
secs = mainloop_timeout;
}

Expand All @@ -5711,19 +5711,19 @@ void LLAppViewer::resumeMainloopTimeout(const std::string& state, F32 secs)

void LLAppViewer::pauseMainloopTimeout()
{
if(mMainloopTimeout)
if (mMainloopTimeout)
{
mMainloopTimeout->stop();
}
}

void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs)
void LLAppViewer::pingMainloopTimeout(std::string_view state, F32 secs)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;

if(mMainloopTimeout)
if (mMainloopTimeout)
{
if(secs < 0.0f)
if (secs < 0.0f)
{
static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60);
secs = mainloop_timeout;
Expand Down
6 changes: 3 additions & 3 deletions indra/newview/llappviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ class LLAppViewer : public LLApp
// For thread debugging.
// llstartup needs to control init.
// llworld, send_agent_pause() also controls pause/resume.
void initMainloopTimeout(const std::string& state, F32 secs = -1.0f);
void initMainloopTimeout(std::string_view state, F32 secs = -1.0f);
void destroyMainloopTimeout();
void pauseMainloopTimeout();
void resumeMainloopTimeout(const std::string& state = "", F32 secs = -1.0f);
void pingMainloopTimeout(const std::string& state, F32 secs = -1.0f);
void resumeMainloopTimeout(std::string_view state = "", F32 secs = -1.0f);
void pingMainloopTimeout(std::string_view state, F32 secs = -1.0f);

// Handle the 'login completed' event.
// *NOTE:Mani Fix this for login abstraction!!
Expand Down
34 changes: 17 additions & 17 deletions indra/newview/llwatchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "llwatchdog.h"
#include "llthread.h"

const U32 WATCHDOG_SLEEP_TIME_USEC = 1000000;
constexpr U32 WATCHDOG_SLEEP_TIME_USEC = 1000000U;

// This class runs the watchdog timing thread.
class LLWatchdogTimerThread : public LLThread
Expand All @@ -51,7 +51,7 @@ class LLWatchdogTimerThread : public LLThread
mSleepMsecs = 1;
}

/* virtual */ void run()
void run() override
{
while(!mStopping)
{
Expand Down Expand Up @@ -83,7 +83,7 @@ void LLWatchdogEntry::start()
void LLWatchdogEntry::stop()
{
// this can happen very late in the shutdown sequence
if (! LLWatchdog::wasDeleted())
if (!LLWatchdog::wasDeleted())
{
LLWatchdog::getInstance()->remove(this);
}
Expand Down Expand Up @@ -117,7 +117,7 @@ void LLWatchdogTimeout::setTimeout(F32 d)
mTimeout = d;
}

void LLWatchdogTimeout::start(const std::string& state)
void LLWatchdogTimeout::start(std::string_view state)
{
if (mTimeout == 0)
{
Expand All @@ -139,9 +139,9 @@ void LLWatchdogTimeout::stop()
mTimer.stop();
}

void LLWatchdogTimeout::ping(const std::string& state)
void LLWatchdogTimeout::ping(std::string_view state)
{
if(!state.empty())
if (!state.empty())
{
mPingState = state;
}
Expand All @@ -151,7 +151,7 @@ void LLWatchdogTimeout::ping(const std::string& state)
// LLWatchdog
LLWatchdog::LLWatchdog()
:mSuspectsAccessMutex()
,mTimer(NULL)
,mTimer(nullptr)
,mLastClockCount(0)
{
}
Expand All @@ -176,7 +176,7 @@ void LLWatchdog::remove(LLWatchdogEntry* e)

void LLWatchdog::init()
{
if(!mSuspectsAccessMutex && !mTimer)
if (!mSuspectsAccessMutex && !mTimer)
{
mSuspectsAccessMutex = new LLMutex();
mTimer = new LLWatchdogTimerThread();
Expand All @@ -191,17 +191,17 @@ void LLWatchdog::init()

void LLWatchdog::cleanup()
{
if(mTimer)
if (mTimer)
{
mTimer->stop();
delete mTimer;
mTimer = NULL;
mTimer = nullptr;
}

if(mSuspectsAccessMutex)
if (mSuspectsAccessMutex)
{
delete mSuspectsAccessMutex;
mSuspectsAccessMutex = NULL;
mSuspectsAccessMutex = nullptr;
}

mLastClockCount = 0;
Expand All @@ -214,12 +214,12 @@ void LLWatchdog::run()
// Check the time since the last call to run...
// If the time elapsed is two times greater than the regualr sleep time
// reset the active timeouts.
const U32 TIME_ELAPSED_MULTIPLIER = 2;
constexpr U32 TIME_ELAPSED_MULTIPLIER = 2;
U64 current_time = LLTimer::getTotalTime();
U64 current_run_delta = current_time - mLastClockCount;
mLastClockCount = current_time;

if(current_run_delta > (WATCHDOG_SLEEP_TIME_USEC * TIME_ELAPSED_MULTIPLIER))
if (current_run_delta > (WATCHDOG_SLEEP_TIME_USEC * TIME_ELAPSED_MULTIPLIER))
{
LL_INFOS() << "Watchdog thread delayed: resetting entries." << LL_ENDL;
for (const auto& suspect : mSuspects)
Expand All @@ -233,7 +233,7 @@ void LLWatchdog::run()
std::find_if(mSuspects.begin(),
mSuspects.end(),
[](const LLWatchdogEntry* suspect){ return ! suspect->isAlive(); });
if(result != mSuspects.end())
if (result != mSuspects.end())
{
// error!!!
if(mTimer)
Expand All @@ -251,15 +251,15 @@ void LLWatchdog::run()

void LLWatchdog::lockThread()
{
if(mSuspectsAccessMutex != NULL)
if (mSuspectsAccessMutex)
{
mSuspectsAccessMutex->lock();
}
}

void LLWatchdog::unlockThread()
{
if(mSuspectsAccessMutex != NULL)
if (mSuspectsAccessMutex)
{
mSuspectsAccessMutex->unlock();
}
Expand Down
12 changes: 6 additions & 6 deletions indra/newview/llwatchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ class LLWatchdogTimeout : public LLWatchdogEntry
LLWatchdogTimeout();
virtual ~LLWatchdogTimeout();

/* virtual */ bool isAlive() const;
/* virtual */ void reset();
/* virtual */ void start() { start(""); }
/* virtual */ void stop();
bool isAlive() const override;
void reset() override;
void start() override { start(""); }
void stop() override;

void start(const std::string& state);
void start(std::string_view state);
void setTimeout(F32 d);
void ping(const std::string& state);
void ping(std::string_view state);
const std::string& getState() {return mPingState; }

private:
Expand Down
Loading