Mercurial > ecos
changeset 356:b77e86276ec3
* src/common/clock.cxx (add_alarm): Tweak last change to allow
alarm order for identical alarms to be the same as it used to be.
* src/common/clock.cxx (add_alarm): Fix bug resulting in alarms
not being added at all if a lower triggered alarm already exists.
Reported by Christoph Csebits.
Also fix bug when alarm is entered for the same time as tail.
These bugs only apply for CYGIMP_KERNEL_COUNTERS_SORT_LIST enabled.
* doc/kernel.sgml: document that order of callback for alarms at
identical times is unspecified.
| author | jlarmour |
|---|---|
| date | Tue, 01 Oct 2002 19:10:21 +0000 |
| parents | 115b5cde8e53 |
| children | 2808fe605ef0 |
| files | packages/kernel/current/ChangeLog packages/kernel/current/doc/kernel.sgml packages/kernel/current/src/common/clock.cxx |
| diffstat | 3 files changed, 32 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/kernel/current/ChangeLog +++ b/packages/kernel/current/ChangeLog @@ -1,3 +1,19 @@ +2002-10-01 Jonathan Larmour <jifl@eCosCentric.com> + + * src/common/clock.cxx (add_alarm): Tweak last change to allow + alarm order for identical alarms to be the same as it used to be. + +2002-09-30 Jonathan Larmour <jifl@eCosCentric.com> + + * src/common/clock.cxx (add_alarm): Fix bug resulting in alarms + not being added at all if a lower triggered alarm already exists. + Reported by Christoph Csebits. + Also fix bug when alarm is entered for the same time as tail. + These bugs only apply for CYGIMP_KERNEL_COUNTERS_SORT_LIST enabled. + + * doc/kernel.sgml: document that order of callback for alarms at + identical times is unspecified. + 2002-08-08 Nick Garnett <nickg@calivar.demon.co.uk> * src/sched/sched.cxx (unlock_inner): Removed initial
--- a/packages/kernel/current/doc/kernel.sgml +++ b/packages/kernel/current/doc/kernel.sgml @@ -2485,6 +2485,10 @@ a clock interrupt. If the alarm is assoc application-specific counter then the details will depend on how that counter is updated. </para> + <para> +If two or more alarms are registered for precisely the same counter tick, +the order of execution of the alarm functions is unspecified. + </para> </refsect1> <refsect1 id="kernel-alarms-context"><title>Valid contexts</title>
--- a/packages/kernel/current/src/common/clock.cxx +++ b/packages/kernel/current/src/common/clock.cxx @@ -9,6 +9,7 @@ // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2002 Jonathan Larmour // // eCos is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -346,32 +347,35 @@ void Cyg_Counter::add_alarm( Cyg_Alarm * #ifdef CYGIMP_KERNEL_COUNTERS_SORT_LIST // Now that we have the list pointer, we can use common code for - // both list oragnizations. + // both list organizations. Cyg_Alarm *list_alarm = alarm_list_ptr->get_head(); if( list_alarm != NULL ) + { do { CYG_ASSERTCLASS(list_alarm, "Bad alarm in counter list" ); - // The alarms are in ascending trigger order. When we - // find an alarm that is later than us, we go in front of - // it. + // The alarms are in ascending trigger order. If we + // find an alarm that triggers later than us, we go + // in front of it. if( list_alarm->trigger > alarm->trigger ) { alarm_list_ptr->insert( list_alarm, alarm ); - break; + goto add_alarm_unlock_return; } list_alarm = list_alarm->get_next(); } while( list_alarm != alarm_list_ptr->get_head() ); + // a lower or equal alarm time was not found, so drop through + // so it is added to the list tail + } + alarm_list_ptr->add_tail( alarm ); - else - alarm_list_ptr->add_tail( alarm ); - + add_alarm_unlock_return: #else alarm_list_ptr->add_tail( alarm );
