blob: 63a335810b6bdd902d9ed28c634db46f385eff6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#include <vdr/channels.h>
#include "tasks.h"
namespace vdrlive {
TaskManager::TaskManager():
m_switchChannel( 0 ),
m_switchResult( false )
{
}
bool TaskManager::SwitchChannel( int number )
{
cMutexLock lock( this );
m_switchChannel = number;
m_scheduleWait.Wait( *this );
return m_switchResult;
}
void TaskManager::DoScheduledWork()
{
if ( m_switchChannel == 0 )
return;
cMutexLock lock( this );
if ( m_switchChannel != 0 ) {
m_switchResult = Channels.SwitchTo( m_switchChannel );
m_switchChannel = 0;
m_scheduleWait.Broadcast();
}
}
TaskManager& LiveTaskManager()
{
static TaskManager instance;
return instance;
}
} // namespace vdrlive
|