File: thread.cpp

package info (click to toggle)
vdr-plugin-live 3.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,116 kB
  • sloc: cpp: 12,988; javascript: 3,220; makefile: 241; sh: 40
file content (45 lines) | stat: -rw-r--r-- 742 bytes parent folder | download | duplicates (2)
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
40
41
42
43
44
45

#include "thread.h"

#include "tntconfig.h"

#include <vdr/tools.h>

namespace vdrlive {

using namespace tnt;


ServerThread::ServerThread()
{
}

ServerThread::~ServerThread()
{
  Stop();
}

void ServerThread::Stop()
{
  if ( Active() ) {
    m_server->shutdown();
    Cancel( 5 );
  }
}

void ServerThread::Action()
{
  try {
    m_server.reset(new Tntnet());
    TntConfig::Get().Configure(*m_server);
    m_server->run();
    m_server.reset(0);
  } catch (std::exception const& ex) {
    // XXX move initial error handling to live.cpp
    esyslog("live: ERROR: live httpd server crashed: %s", ex.what());
    std::cerr << "HTTPD FATAL ERROR: " << ex.what() << std::endl;
    //cThread::EmergencyExit(true);
  }
}

} // namespace vdrlive