summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Engel <dengel@mythtv.org>2010-12-14 20:26:27 (GMT)
committer David Engel <dengel@mythtv.org>2010-12-14 20:34:17 (GMT)
commit5b7beedb977a81bc54956a252ae0322a5157d223 (patch)
tree243aca85c794ea21eae2cde929a85550cdbbccc4
parent14057823c9f43689f3cb8e68afa2912ee68b4390 (diff)
Backport to fixes/0.24.
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.
-rw-r--r--mythtv/programs/mythbackend/scheduler.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp
index 3f42894..b3676ad 100644
--- a/mythtv/programs/mythbackend/scheduler.cpp
+++ b/mythtv/programs/mythbackend/scheduler.cpp
@@ -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";
@@ -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();
@@ -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