[ros-diffs] [cgutman] 48752: [NDIS] - Fix timer queuing - See issue #5461 for details

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sun Sep 12 11:57:56 UTC 2010


Author: cgutman
Date: Sun Sep 12 11:57:55 2010
New Revision: 48752

URL: http://svn.reactos.org/svn/reactos?rev=48752&view=rev
Log:
[NDIS]
- Fix timer queuing
- See issue #5461 for details

Modified:
    trunk/reactos/drivers/network/ndis/ndis/time.c

Modified: trunk/reactos/drivers/network/ndis/ndis/time.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/time.c?rev=48752&r1=48751&r2=48752&view=diff
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/time.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/time.c [iso-8859-1] Sun Sep 12 11:57:55 2010
@@ -247,16 +247,21 @@
 
   /* relative delays are negative, absolute are positive; resolution is 100ns */
   Timeout.QuadPart = Int32x32To64(MillisecondsPeriod, -10000);
-
+    
+  /* Lock the miniport block */
   KeAcquireSpinLock(&Timer->Miniport->Lock, &OldIrql);
-  /* If KeSetTimer(Ex) returns FALSE then the timer is not in the system's queue (and not in ours either) */
-  if (!KeSetTimerEx(&Timer->Timer, Timeout, MillisecondsPeriod, &Timer->Dpc))
-  {
-      /* Add the timer at the head of the timer queue */
-      Timer->NextDeferredTimer = Timer->Miniport->TimerQueue;
-      Timer->Miniport->TimerQueue = Timer;
-  }
+
+  /* Attempt to dequeue the timer */
+  DequeueMiniportTimer(Timer);
+
+  /* Add the timer at the head of the timer queue */
+  Timer->NextDeferredTimer = Timer->Miniport->TimerQueue;
+  Timer->Miniport->TimerQueue = Timer;
+
+  /* Unlock the miniport block */
   KeReleaseSpinLock(&Timer->Miniport->Lock, OldIrql);
+
+  KeSetTimerEx(&Timer->Timer, Timeout, MillisecondsPeriod, &Timer->Dpc);
 }
 
 
@@ -288,15 +293,20 @@
   /* relative delays are negative, absolute are positive; resolution is 100ns */
   Timeout.QuadPart = Int32x32To64(MillisecondsToDelay, -10000);
 
+  /* Lock the miniport block */
   KeAcquireSpinLock(&Timer->Miniport->Lock, &OldIrql);
-  /* If KeSetTimer(Ex) returns FALSE then the timer is not in the system's queue (and not in ours either) */
-  if (!KeSetTimer(&Timer->Timer, Timeout, &Timer->Dpc))
-  {
-      /* Add the timer at the head of the timer queue */
-      Timer->NextDeferredTimer = Timer->Miniport->TimerQueue;
-      Timer->Miniport->TimerQueue = Timer;
-  }
+
+  /* Attempt to dequeue the timer */
+  DequeueMiniportTimer(Timer);
+
+  /* Add the timer at the head of the timer queue */
+  Timer->NextDeferredTimer = Timer->Miniport->TimerQueue;
+  Timer->Miniport->TimerQueue = Timer;
+
+  /* Unlock the miniport block */
   KeReleaseSpinLock(&Timer->Miniport->Lock, OldIrql);
+
+  KeSetTimer(&Timer->Timer, Timeout, &Timer->Dpc);
 }
 
 




More information about the Ros-diffs mailing list