mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
lcdd: add proper destructor to kill time thread
This commit is contained in:
@@ -109,6 +109,17 @@ CLCD::CLCD()
|
|||||||
*/
|
*/
|
||||||
has_lcd = false;
|
has_lcd = false;
|
||||||
clearClock = 0;
|
clearClock = 0;
|
||||||
|
fontRenderer = NULL;
|
||||||
|
thread_started = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CLCD::~CLCD()
|
||||||
|
{
|
||||||
|
if (thread_started) {
|
||||||
|
thread_started = false;
|
||||||
|
pthread_join(thrTime, NULL);
|
||||||
|
}
|
||||||
|
delete fontRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLCD* CLCD::getInstance()
|
CLCD* CLCD::getInstance()
|
||||||
@@ -140,9 +151,10 @@ void CLCD::wake_up() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOXMODEL_DM500
|
#ifndef BOXMODEL_DM500
|
||||||
void* CLCD::TimeThread(void *)
|
void* CLCD::TimeThread(void *p)
|
||||||
{
|
{
|
||||||
while(1)
|
((CLCD *)p)->thread_started = true;
|
||||||
|
while (((CLCD *)p)->thread_started)
|
||||||
{
|
{
|
||||||
sleep(1);
|
sleep(1);
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
@@ -152,6 +164,7 @@ void* CLCD::TimeThread(void *)
|
|||||||
} else
|
} else
|
||||||
CLCD::getInstance()->wake_up();
|
CLCD::getInstance()->wake_up();
|
||||||
}
|
}
|
||||||
|
printf("CLCD::TimeThread exit\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -202,7 +215,7 @@ void CLCD::init(const char * fontfile, const char * fontname,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pthread_create (&thrTime, NULL, TimeThread, NULL) != 0 )
|
if (pthread_create (&thrTime, NULL, TimeThread, this) != 0 )
|
||||||
{
|
{
|
||||||
perror("[lcdd]: pthread_create(TimeThread)");
|
perror("[lcdd]: pthread_create(TimeThread)");
|
||||||
return ;
|
return ;
|
||||||
|
@@ -150,6 +150,7 @@ class CLCD
|
|||||||
bool movie_is_ac3;
|
bool movie_is_ac3;
|
||||||
CConfigFile configfile;
|
CConfigFile configfile;
|
||||||
pthread_t thrTime;
|
pthread_t thrTime;
|
||||||
|
bool thread_started;
|
||||||
int last_toggle_state_power;
|
int last_toggle_state_power;
|
||||||
int clearClock;
|
int clearClock;
|
||||||
unsigned int timeout_cnt;
|
unsigned int timeout_cnt;
|
||||||
@@ -235,9 +236,7 @@ class CLCD
|
|||||||
void Clear();
|
void Clear();
|
||||||
void ShowIcon(vfd_icon icon, bool show);
|
void ShowIcon(vfd_icon icon, bool show);
|
||||||
void ShowText(const char *s) { showServicename(std::string(s), true); };
|
void ShowText(const char *s) { showServicename(std::string(s), true); };
|
||||||
#ifndef HAVE_TRIPLEDRAGON
|
|
||||||
~CLCD();
|
~CLCD();
|
||||||
#endif
|
|
||||||
#ifdef LCD_UPDATE
|
#ifdef LCD_UPDATE
|
||||||
private:
|
private:
|
||||||
CFileList* m_fileList;
|
CFileList* m_fileList;
|
||||||
|
Reference in New Issue
Block a user