Merge pull request #78 from joerg-krause/master

Fix segfault with musl libc – allocate the player thread enough stack space.
This commit is contained in:
Mike Brady
2015-05-28 16:38:05 +01:00
2 changed files with 12 additions and 3 deletions
+11 -2
View File
@@ -36,12 +36,13 @@
#include <pthread.h>
#include <math.h>
#include <sys/stat.h>
#include <sys/signal.h>
#include <signal.h>
#include <sys/syslog.h>
#include <assert.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include "config.h"
@@ -1104,7 +1105,15 @@ int player_play(stream_cfg *stream) {
if (rc)
debug(1,"Error initialising condition variable.");
config.output->start(sampling_rate);
pthread_create(&player_thread, NULL, player_thread_func, NULL);
size_t size = (PTHREAD_STACK_MIN + 128 * 1024);
pthread_attr_t tattr;
pthread_attr_init(&tattr);
rc = pthread_attr_setstacksize(&tattr, size);
if (rc)
debug(1, "Error setting stack size for player_thread: %s", strerror(errno));
pthread_create(&player_thread, &tattr, player_thread_func, NULL);
pthread_attr_destroy(&tattr);
return 0;
}
+1 -1
View File
@@ -39,7 +39,7 @@
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <sys/poll.h>
#include <poll.h>
#include "config.h"