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:26:27 (GMT)
commit966ad7d971e3c3c19a1e0c3f8b581238489c47c9 (patch)
treee4f2120af58e8f18872b60fd1beafdc738c43d4f
parentc24cf98a66f30eae50fa625b9d386081f76b716b (diff)
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 a387010..0daac34 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