From e364523d8357ef22e419e673f454f99fa17ec2ac Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 23 Sep 2013 14:53:02 +0200 Subject: [PATCH 6/8] core: don't use shared event in Windows pa_poll() We call pa_poll concurrently from multiple threads, so we cannot have an event object that is reused. --- src/pulsecore/poll-win32.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pulsecore/poll-win32.c b/src/pulsecore/poll-win32.c index 4a70171..25c9860 100644 --- a/src/pulsecore/poll-win32.c +++ b/src/pulsecore/poll-win32.c @@ -377,7 +377,7 @@ pa_poll (struct pollfd *pfd, nfds_t nfd, int timeout) # endif /* OPEN_MAX -- else, no check is needed */ # endif /* !_SC_OPEN_MAX */ #else /* WINDOWS_NATIVE*/ - static HANDLE hEvent; + HANDLE hEvent; WSANETWORKEVENTS ev; HANDLE h, handle_array[FD_SETSIZE + 2]; DWORD ret, wait_timeout, nhandles; @@ -477,8 +477,7 @@ pa_poll (struct pollfd *pfd, nfds_t nfd, int timeout) return rc; #else - if (!hEvent) - hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); + hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); restart: handle_array[0] = hEvent; @@ -639,6 +638,8 @@ restart: goto restart; } + CloseHandle(hEvent); + return rc; #endif } -- 1.8.3.1