summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--streamer.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/streamer.c b/streamer.c
index f02efed..7ba83ac 100644
--- a/streamer.c
+++ b/streamer.c
@@ -1,5 +1,3 @@
-#include <bits/pthreadtypes.h>
-#include <bits/types/sigset_t.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>
@@ -29,16 +27,6 @@ struct Streamer {
char *current_song;
};
-/* ===== Thread-local storage ===== */
-static pthread_key_t streamer_worker_key;
-static pthread_once_t streamer_worker_once = PTHREAD_ONCE_INIT;
-
-static void streamer_worker_key_create(void)
-{
- pthread_key_create(&streamer_worker_key, NULL);
-}
-
-
/* ====== Streamer initialisation ===== */
static void *streamer_worker (void *t);
@@ -48,8 +36,6 @@ Streamer *streamer_init (const struct StreamerOpt *opts)
Playlist *p = NULL;
HLSRemuxer *r = NULL;
- pthread_once(&streamer_worker_once, streamer_worker_key_create);
-
if ((s = malloc(sizeof(*s))) == NULL)
goto error;
if ((p = playlist_init()) == NULL)
@@ -148,18 +134,6 @@ void streamer_free (Streamer *s)
free(s);
}
-
-static void streamer_worker_sighandler(int sig)
-{
- Streamer *streamer;
- streamer = pthread_getspecific(streamer_worker_key);
-
- pthread_mutex_lock(&streamer->state_mutex);
- streamer->state = STATE_TERM;
- pthread_mutex_unlock(&streamer->state_mutex);
-}
-
-
static inline int streamer_worker_conf_priority(void)
{
errno = 0;
@@ -167,38 +141,15 @@ static inline int streamer_worker_conf_priority(void)
return errno ? -1 : 0;
}
-static inline int streamer_worker_conf_sighandling(void)
-{
- sigset_t set;
- struct sigaction sigact;
-
- /* Configure SIGTERM interuptor */
- sigact.sa_handler = streamer_worker_sighandler;
- sigact.sa_flags = 0;
- sigemptyset(&sigact.sa_mask);
- sigaction(SIGTERM, &sigact, NULL); // term
- sigaction(SIGUSR1, &sigact, NULL); // play/pause
- sigaction(SIGUSR2, &sigact, NULL); // skip
-
- /* Unblock SIGTERM */
- sigemptyset(&set);
- sigaddset(&set, SIGTERM);
- sigaddset(&set, SIGUSR1);
- sigaddset(&set, SIGUSR2);
- pthread_sigmask(SIG_UNBLOCK, &set, NULL);
-}
-
static void *streamer_worker(void *arg)
{
Streamer *s;
struct Entry next;
- pthread_setspecific(streamer_worker_key, (s = arg));
/* Configure worker */
pthread_mutex_lock(&s->worker_ready_mutex);
streamer_worker_conf_priority();
- streamer_worker_conf_sighandling();
s->worker_ready_flag = 1;
pthread_cond_broadcast(&s->worker_ready_cond);
pthread_mutex_unlock(&s->worker_ready_mutex);