Skip to content

Commit

Permalink
Backport to fixes/0.24.
Browse files Browse the repository at this point in the history
Release scheduler lock while running startup/shutdown commands.

Temporarily release the scheduler lock while running any external
startup or shutdown commands.  This allows those commands to query the
backend to get the current schedule if needed.  Fixes #9363.
  • Loading branch information
gigem committed Dec 14, 2010
1 parent 1405782 commit 5b7beed
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions mythtv/programs/mythbackend/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,8 @@ void Scheduler::RunScheduler(void)

if (firstRun)
{
firstRun = false;

//the parameter given to the startup_cmd. "user" means a user
// started the BE, 'auto' means it was started automatically
QString startupParam = "user";
Expand Down Expand Up @@ -1853,9 +1855,12 @@ void Scheduler::RunScheduler(void)
if (!startupCommand.isEmpty())
{
startupCommand.replace("$status", startupParam);
schedLock.unlock();
myth_system(startupCommand);
schedLock.lock();
if (reclist_changed)
continue;
}
firstRun = false;
}

PutInactiveSlavesToSleep();
Expand Down Expand Up @@ -2428,10 +2433,12 @@ void Scheduler::ShutdownServer(int prerollseconds, QDateTime &idleSince)
"this computer :-\n\t\t\t\t\t\t") + halt_cmd);

// and now shutdown myself
if (!myth_system(halt_cmd))
schedLock.unlock();
unsigned int res = myth_system(halt_cmd);
schedLock.lock();
if (!res)
return;
else
VERBOSE(VB_IMPORTANT, "ServerHaltCommand failed, shutdown aborted");
VERBOSE(VB_IMPORTANT, "ServerHaltCommand failed, shutdown aborted");
}

// If we make it here then either the shutdown failed
Expand Down

0 comments on commit 5b7beed

Please sign in to comment.