Skip to content

Commit 80ffe69

Browse files
hujun260zyfeier
authored andcommitted
sched/tcb: change the type of tcb->flags to atomic_t
The previous commits access tcb->flags only through atomic_read(), atomic_or() and atomic_and(). Give the field the atomic_t type those operations are declared for. With the field atomic, a plain |= or &= added later is compiled into a __atomic_fetch_* library call. NuttX does not provide those on chips without atomic instructions (Cortex-M0), so such an access fails to link there instead of silently racing. Signed-off-by: hujun5 <hujun5@xiaomi.com> Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
1 parent 7d93b94 commit 80ffe69

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎include/nuttx/sched.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ struct tcb_s
665665
uint8_t cpu; /* CPU index if running/assigned */
666666
cpu_set_t affinity; /* Bit set of permitted CPUs */
667667
#endif
668-
uint32_t flags; /* Misc. general status flags */
668+
atomic_t flags; /* Misc. general status flags */
669669
int16_t lockcount; /* 0=preemptible (not-locked) */
670670
#ifdef CONFIG_IRQCOUNT
671671
int16_t irqcount; /* 0=Not in critical section */

0 commit comments

Comments
 (0)