]> code.delx.au - pulseaudio/blobdiff - src/pulse/thread-mainloop.c
add i18n support
[pulseaudio] / src / pulse / thread-mainloop.c
index 0ed54837055f0038740a10739248d01102bb59f0..fb73ff1bee27a603747615d5233eea656b609040 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
   This file is part of PulseAudio.
 
 #include <signal.h>
 #include <stdio.h>
 
-#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
+#ifdef HAVE_POLL_H
+#include <poll.h>
 #else
 #include <pulsecore/poll.h>
 #endif
 
 #include <pulse/xmalloc.h>
 #include <pulse/mainloop.h>
+#include <pulse/i18n.h>
 
 #include <pulsecore/log.h>
 #include <pulsecore/hashmap.h>
@@ -96,6 +95,8 @@ static void thread(void *userdata) {
 pa_threaded_mainloop *pa_threaded_mainloop_new(void) {
     pa_threaded_mainloop *m;
 
+    pa_init_i18n();
+
     m = pa_xnew(pa_threaded_mainloop, 1);
 
     if (!(m->real_mainloop = pa_mainloop_new())) {
@@ -103,7 +104,7 @@ pa_threaded_mainloop *pa_threaded_mainloop_new(void) {
         return NULL;
     }
 
-    m->mutex = pa_mutex_new(1);
+    m->mutex = pa_mutex_new(TRUE, TRUE);
     m->cond = pa_cond_new();
     m->accept_cond = pa_cond_new();
     m->thread = NULL;
@@ -223,3 +224,9 @@ pa_mainloop_api* pa_threaded_mainloop_get_api(pa_threaded_mainloop*m) {
 
     return pa_mainloop_get_api(m->real_mainloop);
 }
+
+int pa_threaded_mainloop_in_thread(pa_threaded_mainloop *m) {
+    pa_assert(m);
+
+    return m->thread && pa_thread_self() == m->thread;
+}