[ros-diffs] [janderwald] 47069: [WIN32K] <bug> - The timer implementation uses a bitmap to store window-less timers. As an optimization to find the first free index, it uses the variable "HintIndex" which points to the first timer index. In order to find the next free index, the RtlFindClearBitsAndSet function is used. When a new timer is allocated, the "HintIndex" variable is increased, which increases the search offset. Now if more than NUM_WINDOW_LESS_TIMERS (1024) timers are allocated, no more timers can be allocated because RtlFindClearBitsAndSet will claim no more index are available, because the free indexes are below the search offset. </bug> <fix> Everytime a timer gets freed, store the freed index in "HintIndex". As a result the timer implementation will always find a free timer index (when there is one) </fix>

janderwald at svn.reactos.org janderwald at svn.reactos.org
Sat May 1 11:55:19 CEST 2010


Author: janderwald
Date: Sat May  1 11:55:16 2010
New Revision: 47069

URL: http://svn.reactos.org/svn/reactos?rev=47069&view=rev
Log:
[WIN32K]
<bug>
- The timer implementation uses a bitmap to store window-less timers. As an optimization to find the first free index, it uses the variable "HintIndex" which points to the first timer index. In order to find the next free index, the RtlFindClearBitsAndSet function is used. When a new timer is allocated, the "HintIndex" variable is increased, which increases the search offset. Now if more than NUM_WINDOW_LESS_TIMERS (1024) timers are allocated, no more timers can be allocated because RtlFindClearBitsAndSet will claim no more index are available, because the free indexes are below the search offset. 
</bug>
<fix>
Everytime a timer gets freed, store the freed index in "HintIndex". As a result the timer implementation will always find a free timer index (when there is one)
</fix>

Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/timer.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/timer.c?rev=47069&r1=47068&r2=47069&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] Sat May  1 11:55:16 2010
@@ -526,6 +526,8 @@
       ASSERT(RtlAreBitsSet(&WindowLessTimersBitMap, IDEvent - 1, 1));
       RtlClearBits(&WindowLessTimersBitMap, IDEvent - 1, 1);
 
+      HintIndex = IDEvent - 1;
+
       IntUnlockWindowlessTimerBitmap();
    }
 




More information about the Ros-diffs mailing list