summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2013-09-20 10:28:20 +0200
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-06-06 15:50:24 +0300
commit6f4e08140fd048a21cadf12e7bb6cd9877617c80 (patch)
tree04cf8dbeea3920ae3af747bb22b86920fbf75b13
parentf70ec2776aefe706c8ee510f1c6c44c637c02b64 (diff)
daemon: get rid of win32 message timer
We don't need a timer to check for Windows messages anymore now that our fancy new poll() implementation does that for us.
-rw-r--r--src/daemon/main.c34
-rw-r--r--src/pulsecore/poll-win32.c10
2 files changed, 8 insertions, 36 deletions
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 02a8ea649..c5a7d2829 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -114,27 +114,6 @@ int deny_severity = LOG_WARNING;
int __padsp_disabled__ = 7;
#endif
-#ifdef OS_IS_WIN32
-
-static void message_cb(pa_mainloop_api*a, pa_time_event*e, const struct timeval *tv, void *userdata) {
- MSG msg;
- struct timeval tvnext;
-
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
- if (msg.message == WM_QUIT)
- raise(SIGTERM);
- else {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
-
- pa_timeval_add(pa_gettimeofday(&tvnext), 100000);
- a->time_restart(e, &tvnext);
-}
-
-#endif
-
static void signal_callback(pa_mainloop_api*m, pa_signal_event *e, int sig, void *userdata) {
pa_log_info(_("Got signal %s."), pa_sig2str(sig));
@@ -410,10 +389,6 @@ int main(int argc, char *argv[]) {
int daemon_pipe[2] = { -1, -1 };
int daemon_pipe2[2] = { -1, -1 };
#endif
-#ifdef OS_IS_WIN32
- pa_time_event *win32_timer;
- struct timeval win32_tv;
-#endif
int autospawn_fd = -1;
bool autospawn_locked = false;
#ifdef HAVE_DBUS
@@ -1071,10 +1046,6 @@ int main(int argc, char *argv[]) {
pa_signal_new(SIGHUP, signal_callback, c);
#endif
-#ifdef OS_IS_WIN32
- win32_timer = pa_mainloop_get_api(mainloop)->time_new(pa_mainloop_get_api(mainloop), pa_gettimeofday(&win32_tv), message_cb, NULL);
-#endif
-
if (!conf->no_cpu_limit)
pa_assert_se(pa_cpu_limit_init(pa_mainloop_get_api(mainloop)) == 0);
@@ -1169,11 +1140,6 @@ finish:
pa_autospawn_lock_done(false);
}
-#ifdef OS_IS_WIN32
- if (mainloop && win32_timer)
- pa_mainloop_get_api(mainloop)->time_free(win32_timer);
-#endif
-
if (c) {
/* Ensure all the modules/samples are unloaded when the core is still ref'ed,
* as unlink callback hooks in modules may need the core to be ref'ed */
diff --git a/src/pulsecore/poll-win32.c b/src/pulsecore/poll-win32.c
index 169a1ecd2..c927e53f4 100644
--- a/src/pulsecore/poll-win32.c
+++ b/src/pulsecore/poll-win32.c
@@ -46,6 +46,7 @@ typedef unsigned long nfds_t;
# include <io.h>
# include <stdio.h>
# include <conio.h>
+# include <signal.h>
# if 0
# include "msvc-nothrow.h"
# endif
@@ -568,8 +569,13 @@ restart:
BOOL bRet;
while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0)
{
- TranslateMessage (&msg);
- DispatchMessage (&msg);
+ if (msg.message == WM_QUIT)
+ raise(SIGTERM);
+ else
+ {
+ TranslateMessage (&msg);
+ DispatchMessage (&msg);
+ }
}
}
else