diff options
author | Richard Braun <rbraun@sceen.net> | 2012-12-10 22:13:20 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2012-12-10 22:13:20 +0100 |
commit | 12893de3c255b77d3d0f29fad64c30a86fe8b6d0 (patch) | |
tree | 56b934af31b2d2192a883f9b2e6ce5e096d56cf8 /kern/thread.h | |
parent | e03c74ab431ed86c0c6260959ccf1d4900f5bdd5 (diff) |
kern/thread: fix compiler barrier semantics
Preemption control functions must obviously not be reordered by the
compiler.
Diffstat (limited to 'kern/thread.h')
-rw-r--r-- | kern/thread.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kern/thread.h b/kern/thread.h index 755f3056..fe441e01 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -124,6 +124,8 @@ thread_current(void) /* * Preemption control functions. + * + * Functions that change the preemption state are implicit compiler barriers. */ static inline int @@ -137,6 +139,7 @@ thread_preempt_enable_no_resched(void) { struct thread *thread; + barrier(); thread = thread_current(); assert(thread->preempt != 0); thread->preempt--; @@ -147,6 +150,7 @@ thread_preempt_enable(void) { struct thread *thread; + barrier(); thread = thread_current(); assert(thread->preempt != 0); thread->preempt--; @@ -163,6 +167,7 @@ thread_preempt_disable(void) thread = thread_current(); thread->preempt++; assert(thread->preempt != 0); + barrier(); } #endif /* _KERN_THREAD_H */ |