Thread (2 messages) 2 messages, 2 authors, 2015-11-30

Re: Why a “barrier()” is enough for disabling or enabling the preemption?

From: Doug Wilson <hidden>
Date: 2015-11-30 09:36:21

#define preempt_disable() barrier()
......
#define preempt_enable() barrier()
  Let me try answering this with a limited knowledge I have about barriers.
barrier() essentially was added so that compiler reordering does not happen.

  In the code above, since the compiler does not know/understand the
specialty of preempt_[enable/disable], the compiler might decide to change
the ordering.

 In this case, where the code is disabling/enabling preemption, barrier() tells
the compiler that it can't move stuff around.

 I hope this helps.

- Doug
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help