Put back visible minimum timer resolution to 1 ms.

Decorrelate the service thread resolution from the user required timer
& visible minimum resolutions.
Removed the Callback.TimeFuncProc entry.
This commit is contained in:
Eric Pouech 2000-01-04 00:57:11 +00:00 committed by Alexandre Julliard
parent 939e252bdc
commit a5bad1034e
3 changed files with 80 additions and 55 deletions

View File

@ -1,6 +1,7 @@
Makefile
lolvldrv.glue.c
mmsystem.glue.c
time.glue.c
mmsystem.spec.c
winmm.spec.c
winmm_res.s

View File

@ -19,13 +19,27 @@ C_SRCS = \
time.c
GLUE = lolvldrv.c \
mmsystem.c
mmsystem.c \
time.c
RC_SRCS= \
winmm_res.rc
all: check_wrc $ $(MODULE).o
SUBDIRS = \
mcianim \
mciavi \
mcicda \
mciseq \
mciwave \
midimap \
wavemap \
wineoss
$(SUBDIRS): dummy
@cd $@; $(MAKE)
@MAKE_RULES@
$(RC_SRCS:.rc=.s): $(WRC)

View File

@ -8,8 +8,7 @@
#include <time.h>
#include <sys/time.h>
#include "winbase.h"
#include "callback.h"
#include "winuser.h"
#include "winemm.h"
#include "services.h"
#include "syslevel.h"
@ -23,13 +22,17 @@ DEFAULT_DEBUG_CHANNEL(mmtime)
* as Windows 95 does, according to the docs. Maybe it should
* depend on the computers resources!
*/
#define MMSYSTIME_MININTERVAL /* (1) */ (10)
#define MMSYSTIME_MININTERVAL (1)
#define MMSYSTIME_MAXINTERVAL (65535)
static void TIME_TriggerCallBack(LPWINE_TIMERENTRY lpTimer, DWORD dwCurrent)
/* ### start build ### */
extern WORD CALLBACK TIME_CallTo16_word_wwlll(FARPROC16,WORD,WORD,LONG,LONG,LONG);
/* ### stop build ### */
static void TIME_TriggerCallBack(LPWINE_TIMERENTRY lpTimer)
{
TRACE("before CallBack (%lu) => lpFunc=%p wTimerID=%04X dwUser=%08lX !\n",
dwCurrent, lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser);
TRACE("before CallBack => lpFunc=%p wTimerID=%04X dwUser=%08lX !\n",
lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser);
/* - TimeProc callback that is called here is something strange, under Windows 3.1x it is called
* during interrupt time, is allowed to execute very limited number of API calls (like
@ -41,8 +44,7 @@ static void TIME_TriggerCallBack(LPWINE_TIMERENTRY lpTimer, DWORD dwCurrent)
if (lpTimer->wFlags & WINE_TIMER_IS32)
((LPTIMECALLBACK)lpTimer->lpFunc)(lpTimer->wTimerID, 0, lpTimer->dwUser, 0, 0);
else
Callbacks->CallTimeFuncProc(lpTimer->lpFunc,
lpTimer->wTimerID, 0,
TIME_CallTo16_word_wwlll(lpTimer->lpFunc, lpTimer->wTimerID, 0,
lpTimer->dwUser, 0, 0);
break;
case TIME_CALLBACK_EVENT_SET:
@ -52,7 +54,8 @@ static void TIME_TriggerCallBack(LPWINE_TIMERENTRY lpTimer, DWORD dwCurrent)
PulseEvent((HANDLE)lpTimer->lpFunc);
break;
default:
FIXME("Unknown callback type 0x%04x for mmtime callback (%p), ignored.\n", lpTimer->wFlags, lpTimer->lpFunc);
FIXME("Unknown callback type 0x%04x for mmtime callback (%p), ignored.\n",
lpTimer->wFlags, lpTimer->lpFunc);
break;
}
TRACE("after CallBack !\n");
@ -65,8 +68,13 @@ static void CALLBACK TIME_MMSysTimeCallback(ULONG_PTR ptr_)
{
LPWINE_TIMERENTRY lpTimer, lpNextTimer;
LPWINE_MM_IDATA iData = (LPWINE_MM_IDATA)ptr_;
DWORD delta = GetTickCount() - iData->mmSysTimeMS;
int idx;
TRACE("Time delta: %ld\n", delta);
while (delta >= MMSYSTIME_MININTERVAL) {
delta -= MMSYSTIME_MININTERVAL;
iData->mmSysTimeMS += MMSYSTIME_MININTERVAL;
/* since timeSetEvent() and timeKillEvent() can be called
@ -113,7 +121,8 @@ static void CALLBACK TIME_MMSysTimeCallback(ULONG_PTR ptr_)
LeaveCriticalSection(&iData->cs);
while (idx > 0) {
TIME_TriggerCallBack(&iData->lpTimers[--idx], iData->mmSysTimeMS);
TIME_TriggerCallBack(&iData->lpTimers[--idx]);
}
}
}
@ -138,7 +147,8 @@ static LPWINE_MM_IDATA MULTIMEDIA_MMTimeStart(void)
if (!iData->hMMTimer) {
iData->mmSysTimeMS = GetTickCount();
iData->lpTimerList = NULL;
iData->hMMTimer = SERVICE_AddTimer(MMSYSTIME_MININTERVAL*1000L, TIME_MMSysTimeCallback, (DWORD)iData);
/* 10ms seems a reasonable value ?? */
iData->hMMTimer = SERVICE_AddTimer(10*1000L, TIME_MMSysTimeCallback, (DWORD)iData);
}
return iData;