From 719e83e6e85e24242a95e9a4d48845fd5400dc5b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 24 Sep 2010 17:31:31 +0000 Subject: Fixed bug 3074984, undone change to the virtual timers. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2186 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chvt.h | 1 + os/kernel/src/chschd.c | 9 ++++++--- os/kernel/src/chvt.c | 1 + readme.txt | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/os/kernel/include/chvt.h b/os/kernel/include/chvt.h index 8a44bf703..a7667b92c 100644 --- a/os/kernel/include/chvt.h +++ b/os/kernel/include/chvt.h @@ -87,6 +87,7 @@ typedef struct { list. */ VirtualTimer *vt_prev; /**< @brief Last timer in the delta list. */ + systime_t vt_time; /**< @brief Must be initialized to -1. */ volatile systime_t vt_systime; /**< @brief System Time counter. */ } VTList; diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c index c7db9ad60..f12103324 100644 --- a/os/kernel/src/chschd.c +++ b/os/kernel/src/chschd.c @@ -143,9 +143,12 @@ static void wakeup(void *p) { dequeue(tp); } #endif - /* Done this way in order to allow a tail call.*/ - tp->p_u.rdymsg = RDY_TIMEOUT; - chSchReadyI(tp); + /* Handling the special case where the thread has been made ready by another + thread with higher priority.*/ + if (tp->p_state != THD_STATE_READY) { + tp->p_u.rdymsg = RDY_TIMEOUT; + chSchReadyI(tp); + } } /** diff --git a/os/kernel/src/chvt.c b/os/kernel/src/chvt.c index 070a9c620..b622bb493 100644 --- a/os/kernel/src/chvt.c +++ b/os/kernel/src/chvt.c @@ -42,6 +42,7 @@ VTList vtlist; void vt_init(void) { vtlist.vt_next = vtlist.vt_prev = (void *)&vtlist; + vtlist.vt_time = (systime_t)-1; vtlist.vt_systime = 0; } diff --git a/readme.txt b/readme.txt index 0082dfe65..d29f87b5c 100644 --- a/readme.txt +++ b/readme.txt @@ -62,6 +62,8 @@ ***************************************************************************** *** 2.1.2 *** +- FIX: Fixed race condition in function chSchGoSleepTimeoutS, thanks Balázs + (bug 3074984)(backported to 2.0.5). - FIX: Fixed race condition in threads creation (bug 3069854)(backported to 2.0.5). - FIX: Fixed broken CH_DBG_ENABLE_STACK_CHECK option in legacy CM3 port (bug @@ -108,7 +110,6 @@ change). - NEW: Added to the documentation more notes about interrupt handlers in the ARM7 port. -- OPT: Removed an unused field in the VTList structure. - OPT: Speed optimizations of the STM32 SPI driver, improved latency. - OPT: Speed optimizations of the STM32 ADC driver. - CHANGE: The mailboxes macros chMBSize(), chMBGetEmpty(), chMBGetFull(), -- cgit v1.2.3