changeset 1077:e4850e482c80

* src/common/clock.cxx (Cyg_Counter::rem_alarm): Bugfix: call Cyg_Scheduler::lock() before calculation of index into alarm_list array to avoid race condition with multi list counters.
author jlarmour
date Wed, 25 Jun 2003 17:44:28 +0000
parents ff838098079a
children 5ba0f0c110c8
files packages/kernel/current/ChangeLog packages/kernel/current/src/common/clock.cxx
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packages/kernel/current/ChangeLog
+++ b/packages/kernel/current/ChangeLog
@@ -1,3 +1,9 @@
+2003-06-25  Thomas Binder  <Thomas.Binder@frequentis.com>
+
+	* src/common/clock.cxx (Cyg_Counter::rem_alarm): Bugfix: call
+	Cyg_Scheduler::lock() before calculation of index into alarm_list
+	array to avoid race condition with multi list counters.
+
 2003-06-06  David Brennan  <eCos@brennanhome.com>
 2003-06-23  Nick Garnett  <nickg@balti.calivar.com>
 
--- a/packages/kernel/current/src/common/clock.cxx
+++ b/packages/kernel/current/src/common/clock.cxx
@@ -171,7 +171,7 @@ void Cyg_Counter::tick( cyg_uint32 ticks
 #endif
 
         // Now that we have the list pointer, we can use common code for
-        // both list oragnizations.
+        // both list organizations.
 
 #ifdef CYGIMP_KERNEL_COUNTERS_SORT_LIST
 
@@ -400,9 +400,12 @@ void Cyg_Counter::rem_alarm( Cyg_Alarm *
 #if defined(CYGIMP_KERNEL_COUNTERS_SINGLE_LIST)
 
     alarm_list_ptr = &alarm_list;
+    Cyg_Scheduler::lock();
 
 #elif defined(CYGIMP_KERNEL_COUNTERS_MULTI_LIST)
 
+    Cyg_Scheduler::lock();
+
     alarm_list_ptr = &(alarm_list[
         ((alarm->trigger+increment-1)/increment) %
                               CYGNUM_KERNEL_COUNTERS_MULTI_LIST_SIZE ] );
@@ -414,8 +417,6 @@ void Cyg_Counter::rem_alarm( Cyg_Alarm *
     // Now that we have the list pointer, we can use common code for
     // both list organizations.
 
-    Cyg_Scheduler::lock();
-
     CYG_INSTRUMENT_ALARM( REM, this, alarm );
 
     alarm_list_ptr->remove( alarm );