WINMM: make multimedia threads high priority
Mike McCormack
mike at codeweavers.com
Wed Apr 27 00:37:55 CDT 2005
We don't support thread priority as yet, but this one day we probably will.
Mike
ChangeLog:
* make multimedia threads high priority
-------------- next part --------------
Index: dlls/winmm/mmsystem.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/mmsystem.c,v
retrieving revision 1.114
diff -u -p -r1.114 mmsystem.c
--- dlls/winmm/mmsystem.c 21 Mar 2005 10:55:13 -0000 1.114
+++ dlls/winmm/mmsystem.c 27 Apr 2005 05:37:59 -0000
@@ -1946,6 +1946,7 @@ LRESULT WINAPI mmThreadCreate16(FARPROC1
CloseHandle(lpMMThd->hEvent);
ret = 2;
} else {
+ SetThreadPriority(lpMMThd->hThread, THREAD_PRIORITY_TIME_CRITICAL);
TRACE("Got a nice thread hndl=%p id=0x%08lx\n", lpMMThd->hThread, lpMMThd->dwThreadID);
ret = 0;
}
Index: dlls/winmm/playsound.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/playsound.c,v
retrieving revision 1.14
diff -u -p -r1.14 playsound.c
--- dlls/winmm/playsound.c 23 Dec 2004 20:31:56 -0000 1.14
+++ dlls/winmm/playsound.c 27 Apr 2005 05:37:59 -0000
@@ -471,6 +471,7 @@ static BOOL MULTIMEDIA_PlaySound(const v
wps->bLoop = (fdwSound & SND_LOOP) ? TRUE : FALSE;
if ((handle = CreateThread(NULL, 0, proc_PlaySound, wps, 0, &id)) != 0) {
wps->hThread = handle;
+ SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
return TRUE;
}
}
Index: dlls/winmm/winmm.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winmm.c,v
retrieving revision 1.52
diff -u -p -r1.52 winmm.c
--- dlls/winmm/winmm.c 24 Mar 2005 21:01:35 -0000 1.52
+++ dlls/winmm/winmm.c 27 Apr 2005 05:38:00 -0000
@@ -1792,6 +1792,7 @@ MMRESULT MIDI_StreamOpen(HMIDISTRM* lphM
midiStreamClose((HMIDISTRM)hMidiOut);
return MMSYSERR_NOMEM;
}
+ SetThreadPriority(lpMidiStrm->hThread, THREAD_PRIORITY_TIME_CRITICAL);
/* wait for thread to have started, and for its queue to be created */
{
@@ -2803,6 +2804,7 @@ MMRESULT WINAPI mmTaskCreate(LPTASKCALLB
if (hEvent) CloseHandle(hEvent);
return TASKERR_OUTOFMEMORY;
}
+ SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
if (ph) *ph = hEvent;
CloseHandle(hThread);
return 0;
Index: dlls/winmm/mciavi/mciavi.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/mciavi/mciavi.c,v
retrieving revision 1.31
diff -u -p -r1.31 mciavi.c
--- dlls/winmm/mciavi/mciavi.c 8 Mar 2005 17:00:38 -0000 1.31
+++ dlls/winmm/mciavi/mciavi.c 27 Apr 2005 05:38:00 -0000
@@ -109,6 +109,7 @@ static DWORD MCI_SendCommandAsync(UINT w
WARN("Couldn't allocate thread for async command handling, sending synchronously\n");
return MCI_SCAStarter(&sca);
}
+ SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
CloseHandle(handle);
return 0;
}
Index: dlls/winmm/mciseq/mcimidi.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/mciseq/mcimidi.c,v
retrieving revision 1.27
diff -u -p -r1.27 mcimidi.c
--- dlls/winmm/mciseq/mcimidi.c 24 Mar 2005 21:01:35 -0000 1.27
+++ dlls/winmm/mciseq/mcimidi.c 27 Apr 2005 05:38:00 -0000
@@ -159,6 +159,7 @@ static DWORD MCI_SendCommandAsync(UINT w
WARN("Couldn't allocate thread for async command handling, sending synchonously\n");
return MCI_SCAStarter(&sca);
}
+ SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
CloseHandle(handle);
return 0;
}
Index: dlls/winmm/mciwave/mciwave.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/mciwave/mciwave.c,v
retrieving revision 1.34
diff -u -p -r1.34 mciwave.c
--- dlls/winmm/mciwave/mciwave.c 9 Feb 2005 22:26:25 -0000 1.34
+++ dlls/winmm/mciwave/mciwave.c 27 Apr 2005 05:38:00 -0000
@@ -122,6 +122,7 @@ static DWORD MCI_SendCommandAsync(UINT w
WARN("Couldn't allocate thread for async command handling, sending synchonously\n");
return MCI_SCAStarter(&sca);
}
+ SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
CloseHandle(handle);
return 0;
}
Index: dlls/winmm/winealsa/audio.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winealsa/audio.c,v
retrieving revision 1.78
diff -u -p -r1.78 audio.c
--- dlls/winmm/winealsa/audio.c 22 Apr 2005 19:05:34 -0000 1.78
+++ dlls/winmm/winealsa/audio.c 27 Apr 2005 05:38:01 -0000
@@ -2007,6 +2007,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVE
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
+ if (wwo->hThread)
+ SetThreadPriority(wwo->hThread, THREAD_PRIORITY_TIME_CRITICAL);
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
CloseHandle(wwo->hStartUpEvent);
} else {
@@ -3474,6 +3476,8 @@ static DWORD widOpen(WORD wDevID, LPWAVE
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwi->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD)wDevID, 0, &(wwi->dwThreadID));
+ if (wwi->hThread)
+ SetThreadPriority(wwi->hThread, THREAD_PRIORITY_TIME_CRITICAL);
WaitForSingleObject(wwi->hStartUpEvent, INFINITE);
CloseHandle(wwi->hStartUpEvent);
} else {
Index: dlls/winmm/winealsa/midi.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winealsa/midi.c,v
retrieving revision 1.15
diff -u -p -r1.15 midi.c
--- dlls/winmm/winealsa/midi.c 24 Mar 2005 21:01:35 -0000 1.15
+++ dlls/winmm/winealsa/midi.c 27 Apr 2005 05:38:01 -0000
@@ -462,6 +462,7 @@ static DWORD midOpen(WORD wDevID, LPMIDI
midiCloseSeq();
return MMSYSERR_ERROR;
}
+ SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
TRACE("Created thread for midi-in\n");
}
Index: dlls/winmm/winearts/audio.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winearts/audio.c,v
retrieving revision 1.30
diff -u -p -r1.30 audio.c
--- dlls/winmm/winearts/audio.c 19 Mar 2005 17:11:02 -0000 1.30
+++ dlls/winmm/winearts/audio.c 27 Apr 2005 05:38:01 -0000
@@ -1208,6 +1208,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVE
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
+ if (wwo->hThread)
+ SetThreadPriority(wwo->hThread, THREAD_PRIORITY_TIME_CRITICAL);
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
CloseHandle(wwo->hStartUpEvent);
} else {
@@ -1860,6 +1862,8 @@ static DWORD widOpen(WORD wDevID, LPWAVE
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwi->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD)wDevID, 0, &(wwi->dwThreadID));
+ if (wwi->hThread)
+ SetThreadPriority(wwi->hThread, THREAD_PRIORITY_TIME_CRITICAL);
WaitForSingleObject(wwi->hStartUpEvent, INFINITE);
CloseHandle(wwi->hStartUpEvent);
} else {
Index: dlls/winmm/wineaudioio/audio.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/wineaudioio/audio.c,v
retrieving revision 1.26
diff -u -p -r1.26 audio.c
--- dlls/winmm/wineaudioio/audio.c 24 Mar 2005 21:01:35 -0000 1.26
+++ dlls/winmm/wineaudioio/audio.c 27 Apr 2005 05:38:01 -0000
@@ -894,6 +894,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVE
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwo->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
+ if (wwo->hThread)
+ SetThreadPriority(wwo->hThread, THREAD_PRIORITY_TIME_CRITICAL);
WaitForSingleObject(wwo->hEvent, INFINITE);
} else {
wwo->hEvent = INVALID_HANDLE_VALUE;
@@ -1979,6 +1981,8 @@ static DWORD widOpen(WORD wDevID, LPWAVE
wwi->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD)wDevID, 0, &(wwi->dwThreadID));
+ if (wwi->hThread)
+ SetThreadPriority(wwi->hThread, THREAD_PRIORITY_TIME_CRITICAL);
WaitForSingleObject(wwi->hEvent, INFINITE);
if (LIBAUDIOIO_NotifyClient(wDevID, WIM_OPEN, 0L, 0L) != MMSYSERR_NOERROR) {
Index: dlls/winmm/winenas/audio.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winenas/audio.c,v
retrieving revision 1.23
diff -u -p -r1.23 audio.c
--- dlls/winmm/winenas/audio.c 19 Mar 2005 17:11:02 -0000 1.23
+++ dlls/winmm/winenas/audio.c 27 Apr 2005 05:38:02 -0000
@@ -956,6 +956,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVE
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
+ if (wwo->hThread)
+ SetThreadPriority(wwo->hThread, THREAD_PRIORITY_TIME_CRITICAL);
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
CloseHandle(wwo->hStartUpEvent);
} else {
More information about the wine-patches
mailing list