Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cf1b6535
Commit
cf1b6535
authored
Dec 01, 2003
by
Jukka Heinonen
Committed by
Alexandre Julliard
Dec 01, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add upper limit for the number of pending timer interrupts.
Check if timer has been stuck and issue an error to user. Fix handling of timer period zero.
parent
236ad0df
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
6 deletions
+42
-6
timer.c
dlls/winedos/timer.c
+42
-6
No files found.
dlls/winedos/timer.c
View file @
cf1b6535
...
@@ -35,11 +35,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(int);
...
@@ -35,11 +35,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(int);
* This should also make it possible to
* This should also make it possible to
* emulate really fast timers.
* emulate really fast timers.
* FIXME: Support special timer modes in addition to periodic mode.
* FIXME: Support special timer modes in addition to periodic mode.
* FIXME: Make sure that there are only limited number
* of pending timer IRQ events queued. This makes sure that
* timer handling does not eat all available memory even
* if IRQ handling stops for some reason (suspended process?).
* This is easy to do by using DOSRELAY parameter.
* FIXME: Use timeSetEvent, NtSetEvent or timer thread for more precise
* FIXME: Use timeSetEvent, NtSetEvent or timer thread for more precise
* timing.
* timing.
* FIXME: Move Win16 timer emulation code here.
* FIXME: Move Win16 timer emulation code here.
...
@@ -48,6 +43,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(int);
...
@@ -48,6 +43,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(int);
/* The PC clocks ticks at 1193180 Hz. */
/* The PC clocks ticks at 1193180 Hz. */
#define TIMER_FREQ 1193180
#define TIMER_FREQ 1193180
/* How many timer IRQs can be pending at any time. */
#define TIMER_MAX_PENDING 20
/* Unique system timer identifier. */
/* Unique system timer identifier. */
static
UINT_PTR
TIMER_id
=
0
;
static
UINT_PTR
TIMER_id
=
0
;
...
@@ -57,6 +55,22 @@ static DWORD TIMER_stamp = 0;
...
@@ -57,6 +55,22 @@ static DWORD TIMER_stamp = 0;
/* Timer ticks between timer IRQs. */
/* Timer ticks between timer IRQs. */
static
UINT
TIMER_ticks
=
0
;
static
UINT
TIMER_ticks
=
0
;
/* Number of pending timer IRQs. */
static
LONG
TIMER_pending
=
0
;
/***********************************************************************
* TIMER_Relay
*
* Decrement the number of pending IRQs after IRQ handler has been
* called. This function will be called even if application has its
* own IRQ handler that does not jump to builtin IRQ handler.
*/
static
void
TIMER_Relay
(
CONTEXT86
*
context
,
void
*
data
)
{
InterlockedDecrement
(
&
TIMER_pending
);
}
/***********************************************************************
/***********************************************************************
* TIMER_TimerProc
* TIMER_TimerProc
...
@@ -66,8 +80,26 @@ static void CALLBACK TIMER_TimerProc( HWND hwnd,
...
@@ -66,8 +80,26 @@ static void CALLBACK TIMER_TimerProc( HWND hwnd,
UINT_PTR
idEvent
,
UINT_PTR
idEvent
,
DWORD
dwTime
)
DWORD
dwTime
)
{
{
LONG
pending
=
InterlockedIncrement
(
&
TIMER_pending
);
if
(
pending
>=
TIMER_MAX_PENDING
)
{
DWORD
delta
=
(
dwTime
>=
TIMER_stamp
)
?
(
dwTime
-
TIMER_stamp
)
:
(
0xffffffff
-
(
TIMER_stamp
-
dwTime
));
if
(
delta
>=
60000
)
{
ERR
(
"DOS timer has been stuck for 60 seconds...
\n
"
);
TIMER_stamp
=
dwTime
;
}
InterlockedDecrement
(
&
TIMER_pending
);
}
else
{
TIMER_stamp
=
dwTime
;
TIMER_stamp
=
dwTime
;
DOSVM_QueueEvent
(
0
,
DOS_PRIORITY_REALTIME
,
NULL
,
NULL
);
DOSVM_QueueEvent
(
0
,
DOS_PRIORITY_REALTIME
,
TIMER_Relay
,
NULL
);
}
}
}
...
@@ -119,6 +151,10 @@ UINT WINAPI DOSVM_GetTimer( void )
...
@@ -119,6 +151,10 @@ UINT WINAPI DOSVM_GetTimer( void )
*/
*/
void
WINAPI
DOSVM_SetTimer
(
UINT
ticks
)
void
WINAPI
DOSVM_SetTimer
(
UINT
ticks
)
{
{
/* PIT interprets zero as a maximum length delay. */
if
(
ticks
==
0
)
ticks
=
0x10000
;
if
(
!
DOSVM_IsWin16
())
if
(
!
DOSVM_IsWin16
())
MZ_RunInThread
(
TIMER_DoSetTimer
,
ticks
);
MZ_RunInThread
(
TIMER_DoSetTimer
,
ticks
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment