From f2ea78cdfb6159a748823f3b5e76dd3f916f87f1 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 16 Aug 2004 23:19:17 +0000 Subject: [PATCH] Implemented the mmTask* functions. --- dlls/winmm/winmm.c | 42 ++++++++++++++++++++++++++++++++++++++++-- dlls/winmm/winmm.spec | 4 ++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c index 57415e339d3..10588c04a0a 100644 --- a/dlls/winmm/winmm.c +++ b/dlls/winmm/winmm.c @@ -3233,7 +3233,7 @@ struct mm_starter HANDLE event; }; -DWORD WINAPI mmTaskRun(void* pmt) +static DWORD WINAPI mmTaskRun(void* pmt) { struct mm_starter mms; @@ -3244,6 +3244,9 @@ DWORD WINAPI mmTaskRun(void* pmt) return 0; } +/****************************************************************** + * mmTaskCreate (WINMM.@) + */ MMRESULT WINAPI mmTaskCreate(LPTASKCALLBACK cb, HANDLE* ph, DWORD client) { HANDLE hThread; @@ -3251,7 +3254,7 @@ MMRESULT WINAPI mmTaskCreate(LPTASKCALLBACK cb, HANDLE* ph, DWORD client) struct mm_starter *mms; mms = HeapAlloc(GetProcessHeap(), 0, sizeof(struct mm_starter)); - if (mms == NULL) { return TASKERR_OUTOFMEMORY; } + if (mms == NULL) return TASKERR_OUTOFMEMORY; mms->cb = cb; mms->client = client; @@ -3268,3 +3271,38 @@ MMRESULT WINAPI mmTaskCreate(LPTASKCALLBACK cb, HANDLE* ph, DWORD client) CloseHandle(hThread); return 0; } + +/****************************************************************** + * mmTaskBlock (WINMM.@) + */ +void WINAPI mmTaskBlock(HANDLE tid) +{ + MSG msg; + + do + { + GetMessageA(&msg, 0, 0, 0); + if (msg.hwnd) DispatchMessageA(&msg); + } while (msg.message != WM_USER); +} + +/****************************************************************** + * mmTaskSignal (WINMM.@) + */ +BOOL WINAPI mmTaskSignal(HANDLE tid) +{ + return PostThreadMessageW((DWORD)tid, WM_USER, 0, 0); +} + +/****************************************************************** + * mmTaskYield (WINMM.@) + */ +void WINAPI mmTaskYield(void) {} + +/****************************************************************** + * mmGetCurrentTask (WINMM.@) + */ +HANDLE WINAPI mmGetCurrentTask(void) +{ + return (HANDLE)GetCurrentThreadId(); +} diff --git a/dlls/winmm/winmm.spec b/dlls/winmm/winmm.spec index 7dd06bced9a..031c44ee7b7 100644 --- a/dlls/winmm/winmm.spec +++ b/dlls/winmm/winmm.spec @@ -112,6 +112,7 @@ @ stdcall mixerMessage(long long long long) @ stdcall mixerOpen(ptr long long long long) @ stdcall mixerSetControlDetails(long ptr long) +@ stdcall mmGetCurrentTask() @ stdcall mmioAdvance(long ptr long) @ stdcall mmioAscend(long ptr long) @ stdcall mmioClose(long long) @@ -135,7 +136,10 @@ @ stdcall mmioStringToFOURCCW(wstr long) @ stdcall mmioWrite(long ptr long) @ stdcall mmsystemGetVersion() +@ stdcall mmTaskBlock(long) @ stdcall mmTaskCreate(ptr ptr long) +@ stdcall mmTaskSignal(long) +@ stdcall mmTaskYield() @ stdcall sndPlaySoundA(ptr long) @ stdcall sndPlaySoundW(ptr long) @ stdcall timeBeginPeriod(long)