-/* $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>
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())) {
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;
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;
+}