luaserver: reorganize

Origin commit data
------------------
Branch: ni/coolstream
Commit: b2b7cd8bb1
Author: martii <m4rtii@gmx.de>
Date: 2014-10-13 (Mon, 13 Oct 2014)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
martii
2014-10-13 22:11:25 +02:00
committed by vanhofen
parent 1b16086415
commit 35c83a5302
6 changed files with 309 additions and 194 deletions

View File

@@ -130,6 +130,8 @@
#include <lib/libtuxtxt/teletext.h>
#include <eitd/sectionsd.h>
#include <system/luaserver.h>
int old_b_id = -1;
CInfoClock *InfoClock;
@@ -149,8 +151,6 @@ static bool timerd_thread_started = false;
void * nhttpd_main_thread(void *data);
void * luaserver_main_thread(void *data);
//#define DISABLE_SECTIONSD
extern cVideo * videoDecoder;
@@ -1949,10 +1949,6 @@ TIMER_START();
if (!pthread_create (&nhttpd_thread, NULL, nhttpd_main_thread, (void *) NULL))
pthread_detach (nhttpd_thread);
pthread_t luaserver_thread;
pthread_create (&luaserver_thread, NULL, luaserver_main_thread, (void *) NULL);
pthread_detach(luaserver_thread);
CStreamManager::getInstance()->Start();
#ifndef DISABLE_SECTIONSD
@@ -2112,19 +2108,13 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
//cCA::GetInstance()->Ready(true);
sem_init(&lua_may_run, 0, 0);
sem_init(&lua_did_run, 0, 0);
CLuaServer *luaServer = CLuaServer::getInstance();
while( true ) {
sem_post(&lua_may_run);
luaServer->UnBlock();
g_RCInput->getMsg(&msg, &data, 100, ((g_settings.mode_left_right_key_tv == SNeutrinoSettings::VOLUME) && (g_RemoteControl->subChannels.size() < 1)) ? true : false); // 10 secs..
sem_wait(&lua_may_run);
if (!sem_trywait(&lua_did_run)) {
if (msg != CRCInput::RC_timeout)
g_RCInput->postMsg(msg, data);
while (!sem_trywait(&lua_did_run));
if (luaServer->Block(msg, data))
continue;
}
if( ( mode == mode_tv ) || ( mode == mode_radio ) || ( mode == mode_webtv ) ) {
if( (msg == NeutrinoMessages::SHOW_EPG) /* || (msg == CRCInput::RC_info) */ ) {
@@ -4247,6 +4237,7 @@ bool CNeutrinoApp::StartPip(const t_channel_id channel_id)
void CNeutrinoApp::Cleanup()
{
CLuaServer::destroyInstance();
#ifdef EXIT_CLEANUP
INFO("cleanup...");
printf("cleanup 10\n");fflush(stdout);
@@ -4312,11 +4303,6 @@ void CNeutrinoApp::Cleanup()
delete CEitManager::getInstance();
printf("cleanup 6\n");fflush(stdout);
delete CVFD::getInstance();
// FIXME -- wait for luaserver threads to terminate?
sem_destroy(&lua_may_run);
sem_destroy(&lua_did_run);
#ifdef __UCLIBC__
malloc_stats(NULL);
#else