fix chopstx_cond_broadcast.

This commit is contained in:
NIIBE Yutaka
2013-05-29 12:13:47 +09:00
parent 1d535e3be8
commit 866461d13e
2 changed files with 15 additions and 12 deletions

View File

@@ -6,6 +6,7 @@
only when it's not running. only when it's not running.
(chx_sched): Add an argument for race avoidance. (chx_sched): Add an argument for race avoidance.
(chopstx_intr_wait): Fix the race condition. (chopstx_intr_wait): Fix the race condition.
(chopstx_cond_broadcast): Fix initial value.
* board/board-olimex-stm32-h103.h (NEUG_ADC_SETTING2_*): Add. * board/board-olimex-stm32-h103.h (NEUG_ADC_SETTING2_*): Add.

View File

@@ -243,16 +243,18 @@ ll_prio_enqueue (struct chx_thread *tp0, void *head)
/* /*
* Thread status. * Thread status.
*/ */
#define THREAD_RUNNING 0x00 enum {
#define THREAD_READY 0x01 THREAD_RUNNING=0,
#define THREAD_WAIT_MTX 0x02 THREAD_READY,
#define THREAD_WAIT_CND 0x03 THREAD_WAIT_MTX,
#define THREAD_WAIT_TIME 0x04 THREAD_WAIT_CND,
#define THREAD_WAIT_INT 0x05 THREAD_WAIT_TIME,
#define THREAD_JOIN 0x06 THREAD_WAIT_INT,
/**/ THREAD_JOIN,
#define THREAD_EXITED 0x0E /**/
#define THREAD_FINISHED 0x0F THREAD_EXITED=0x0E,
THREAD_FINISHED=0x0F
};
static uint32_t static uint32_t
@@ -686,7 +688,7 @@ chx_yield (void)
static void __attribute__((noreturn)) static void __attribute__((noreturn))
chx_exit (void *retval) chx_exit (void *retval)
{ {
register uint32_t r4 __asm__ ("r4") = (uint32_t)retval; register uint32_t r4 asm ("r4") = (uint32_t)retval;
struct chx_thread *q; struct chx_thread *q;
asm volatile ("cpsid i" : : : "memory"); asm volatile ("cpsid i" : : : "memory");
@@ -976,7 +978,7 @@ void
chopstx_cond_broadcast (chopstx_cond_t *cond) chopstx_cond_broadcast (chopstx_cond_t *cond)
{ {
struct chx_thread *tp; struct chx_thread *tp;
int yield = 1; int yield = 0;
asm volatile ("cpsid i" : : : "memory"); asm volatile ("cpsid i" : : : "memory");
chx_LOCK (&cond->lock); chx_LOCK (&cond->lock);