[En-Nut-Discussion] Semaphore implementation

Matthias Ringwald mringwal at inf.ethz.ch
Thu May 27 17:53:05 CEST 2004

Hi Ole,

On 27.05.2004, at 17:30, Ole Reinhardt wrote:

> Hi Matthias,
> should'nt be your semaphore functions defined as critical blocks? In
> AFAIK interrupts has to be disabled during some of these atomic
> functions e.g. to avoid taskswitch during an if operation.

As Nut/OS is using co-operative multitasking, taskswitching
only happens in functions where you would assume this.
so it does not happen at unexpected positions,
e.g., after an if conditional check.

Actually,  I did omit calls to NutCriticalEnter & Exit on purpose
to avoid unnecessary operations. As far as  I do understand it,
this is ok as long as the semaphore functions are not called from
an interrupt context (because this would equivalent to 'taskswitching')
As long as they are not called from interrupts, taskswitching only
happens in NutEventPost/Wait functions.

Does this make sense?


More information about the En-Nut-Discussion mailing list