aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMatthew Gregan <[email protected]>2011-11-08 15:36:55 +1300
committerMatthew Gregan <[email protected]>2011-11-08 15:36:55 +1300
commit4a8043881c5620a7cf6dfb6766f77be1fdddbc20 (patch)
tree7675da66b6946d78fb5eecb709a4282bce9bc517 /src
parent082d71e9fa3a4a9240f2c2258a60e4c3cf6b2f3e (diff)
downloadcubeb-4a8043881c5620a7cf6dfb6766f77be1fdddbc20.tar.gz
cubeb-4a8043881c5620a7cf6dfb6766f77be1fdddbc20.zip
alsa: set processing thread stack size to minimum. fix up includes.
Diffstat (limited to 'src')
-rw-r--r--src/cubeb_alsa.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/cubeb_alsa.c b/src/cubeb_alsa.c
index 9806e50..0e16f7d 100644
--- a/src/cubeb_alsa.c
+++ b/src/cubeb_alsa.c
@@ -5,11 +5,13 @@
* accompanying file LICENSE for details.
*/
#undef NDEBUG
-#include <linux/limits.h>
-#include <alsa/asoundlib.h>
+#define _POSIX_SOURCE 1
#include <assert.h>
+#include <limits.h>
#include <pthread.h>
+#include <time.h>
#include <unistd.h>
+#include <alsa/asoundlib.h>
#include "cubeb/cubeb.h"
/* ALSA is not thread-safe. snd_pcm_t instances are individually protected
@@ -310,6 +312,7 @@ cubeb_init(cubeb ** context, char const * context_name)
cubeb * ctx;
int r;
int pipe_fd[2];
+ pthread_attr_t attr;
assert(context);
@@ -326,8 +329,15 @@ cubeb_init(cubeb ** context, char const * context_name)
rebuild_pfds(ctx);
- /* XXX set stack size to minimum */
- r = pthread_create(&ctx->thread, NULL, cubeb_run_thread, ctx);
+ r = pthread_attr_init(&attr);
+ assert(r == 0);
+ r = pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
+ assert(r == 0);
+
+ r = pthread_create(&ctx->thread, &attr, cubeb_run_thread, ctx);
+ assert(r == 0);
+
+ r = pthread_attr_destroy(&attr);
assert(r == 0);
*context = ctx;