epggrab: try to fix the thread kill & wrong memory access

This commit is contained in:
Jaroslav Kysela 2014-12-01 21:25:15 +01:00
parent 70b3ef658b
commit 3e505d77d9
2 changed files with 7 additions and 1 deletions

View file

@ -248,6 +248,7 @@ epggrab_module_int_done( void *m )
{
epggrab_module_int_t *mod = m;
free((char *)mod->path);
mod->path = NULL;
}
epggrab_module_int_t *epggrab_module_int_create
@ -416,7 +417,7 @@ epggrab_module_done_socket( void *m )
shutdown(sock, SHUT_RDWR);
close(sock);
if (mod->tid) {
pthread_kill(mod->tid, SIGTERM);
pthread_kill(mod->tid, SIGQUIT);
pthread_join(mod->tid, NULL);
}
mod->tid = 0;

View file

@ -104,6 +104,9 @@ tvh_fopen(const char *filename, const char *mode)
return f;
}
static void doquit(int sig)
{
}
struct
thread_state {
@ -130,9 +133,11 @@ thread_wrapper ( void *p )
sigemptyset(&set);
sigaddset(&set, SIGTERM);
sigaddset(&set, SIGQUIT);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
signal(SIGTERM, doexit);
signal(SIGQUIT, doquit);
/* Run */
tvhtrace("thread", "created thread %ld [%s / %p(%p)]",