Mercurial > ecos-v3_0-branch
comparison packages/kernel/current/include/clock.hxx @ 1088:4c13726203c5
* include/clock.hxx: Made Cyg_Counter::add_alarm() and
Cyg_Counter::rem_alarm() private functions. They no longer lock
the scheduler, so should not be called directly, only via the
Cyg_Alarm functions.
* include/clock.inl: Removed inline version of
Cyg_Alarm::disable(). It's no longer a one-liner and is thus
better as a proper function.
* src/common/clock.cxx (Cyg_Counter::tick): Rewrote the unsorted
list option. If the function of one alarm adds or removes other
alarms, then is was possible for the list to become corrupted. The
new implementation attempts to avoid this problem.
(Cyg_Alarm::initialize): Added scheduler locking to protect the
enabled flag.
(Cyg_Alarm::enable): Ditto.
(Cyg_Alarm::disable): Ditto. Moved here from clock.inl.
(Cyg_Alarm::add_alarm): Removed scheduler locking, it is now
always called from functions that have already locked it. Added an
assertion to double-check this.
(Cyg_Alarm::rem_alarm): Ditto.
* cdl/kernel.cdl:
* tests/kalarm0.c:
Added new test to test that alarms can be added and removed in
alarm functions safely.
| author | nickg |
|---|---|
| date | Tue, 01 Jul 2003 17:34:53 +0000 |
| parents | d2c90368aeef |
| children | 74dbf4c3f2e1 |
comparison
equal
deleted
inserted
replaced
| 1087:549ccefb35ed | 1088:4c13726203c5 |
|---|---|
| 89 #endif | 89 #endif |
| 90 | 90 |
| 91 volatile cyg_tick_count counter; // counter value | 91 volatile cyg_tick_count counter; // counter value |
| 92 | 92 |
| 93 cyg_uint32 increment; // increment per tick | 93 cyg_uint32 increment; // increment per tick |
| 94 | |
| 95 // Add an alarm to this counter | |
| 96 void add_alarm( Cyg_Alarm *alarm ); | |
| 97 | |
| 98 // Remove an alarm from this counter | |
| 99 void rem_alarm( Cyg_Alarm *alarm ); | |
| 94 | 100 |
| 95 public: | 101 public: |
| 96 | 102 |
| 97 CYGDBG_DEFINE_CHECK_THIS | 103 CYGDBG_DEFINE_CHECK_THIS |
| 98 | 104 |
| 113 // Set the counter's current value | 119 // Set the counter's current value |
| 114 void set_value( cyg_tick_count new_value); | 120 void set_value( cyg_tick_count new_value); |
| 115 | 121 |
| 116 // Advance counter by some number of ticks | 122 // Advance counter by some number of ticks |
| 117 void tick( cyg_uint32 ticks = 1); | 123 void tick( cyg_uint32 ticks = 1); |
| 118 | |
| 119 // Add an alarm to this counter | |
| 120 void add_alarm( Cyg_Alarm *alarm ); | |
| 121 | |
| 122 // Remove an alarm from this counter | |
| 123 void rem_alarm( Cyg_Alarm *alarm ); | |
| 124 | 124 |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 // ------------------------------------------------------------------------- | 127 // ------------------------------------------------------------------------- |
| 128 // Clock class. This is derived from a Counter and defines extra | 128 // Clock class. This is derived from a Counter and defines extra |
