[PATCH 4/6] winmm: Synchronize player status and API calls.
Signed-off-by: Akihiro Sagawa <sagawa.aki(a)gmail.com> --- dlls/winmm/winmm.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
On Mon, May 21, 2018 at 09:36:13PM +0900, Akihiro Sagawa wrote:
+static MMRESULT midistream_post_message_and_wait(WINE_MIDIStream* lpMidiStrm, UINT msg, WPARAM wParam, LPARAM lParam) +{ + ResetEvent(lpMidiStrm->hEvent); + if (!PostThreadMessageA(lpMidiStrm->dwThreadID, msg, wParam, lParam)) { + WARN("bad PostThreadMessageA\n"); + return MMSYSERR_ERROR; + } else if (GetCurrentThreadId() != lpMidiStrm->dwThreadID) { + if (WaitForSingleObject(lpMidiStrm->hEvent, INFINITE) != WAIT_OBJECT_0) {
Sorry for the delay in reviewing these. This seems thread-unsafe to me. Since these are private Wine messages, could we define wParam to be a unique event to signal instead of storing it in the stream object? The rest of the patch sequence looks OK to me. Thanks for working on this, Andrew
participants (2)
-
Akihiro Sagawa -
Andrew Eikum