Commit 0ac55db8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

signals: use the VLC thread API

parent 1b025556
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
# include "config.h" # include "config.h"
#endif #endif
#include <pthread.h>
#include <signal.h> #include <signal.h>
#include <time.h> #include <time.h>
...@@ -46,7 +45,7 @@ vlc_module_end (); ...@@ -46,7 +45,7 @@ vlc_module_end ();
struct intf_sys_t struct intf_sys_t
{ {
pthread_t thread; vlc_thread_t thread;
int signum; int signum;
}; };
...@@ -61,7 +60,7 @@ static int Open (vlc_object_t *obj) ...@@ -61,7 +60,7 @@ static int Open (vlc_object_t *obj)
p_sys->signum = 0; p_sys->signum = 0;
intf->p_sys = p_sys; intf->p_sys = p_sys;
if (pthread_create (&p_sys->thread, NULL, SigThread, obj)) if (vlc_clone (&p_sys->thread, SigThread, obj, VLC_THREAD_PRIORITY_LOW))
{ {
free (p_sys); free (p_sys);
intf->p_sys = NULL; intf->p_sys = NULL;
...@@ -77,14 +76,14 @@ static void Close (vlc_object_t *obj) ...@@ -77,14 +76,14 @@ static void Close (vlc_object_t *obj)
intf_thread_t *intf = (intf_thread_t *)obj; intf_thread_t *intf = (intf_thread_t *)obj;
intf_sys_t *p_sys = intf->p_sys; intf_sys_t *p_sys = intf->p_sys;
pthread_cancel (p_sys->thread); vlc_cancel (p_sys->thread);
#ifdef __APPLE__ #ifdef __APPLE__
/* In Mac OS X up to 10.5 sigwait (among others) is not a pthread /* In Mac OS X up to 10.5 sigwait (among others) is not a pthread
* cancellation point, so we throw a dummy quit signal to end * cancellation point, so we throw a dummy quit signal to end
* sigwait() in the sigth thread */ * sigwait() in the sigth thread */
pthread_kill (p_sys->thread, SIGQUIT); pthread_kill (p_sys->thread, SIGQUIT);
# endif # endif
pthread_join (p_sys->thread, NULL); vlc_join (p_sys->thread, NULL);
free (p_sys); free (p_sys);
} }
...@@ -111,7 +110,7 @@ static void *SigThread (void *data) ...@@ -111,7 +110,7 @@ static void *SigThread (void *data)
#ifdef __APPLE__ #ifdef __APPLE__
/* In Mac OS X up to 10.5 sigwait (among others) is not a pthread /* In Mac OS X up to 10.5 sigwait (among others) is not a pthread
* cancellation point */ * cancellation point */
pthread_testcancel(); vlc_testcancel();
#endif #endif
vlc_object_lock (obj); vlc_object_lock (obj);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment