Echelon Neuron C User Manual

Page 222

Advertising
background image

202

Built-In Variables, Objects, Symbols, and Semaphore


__lock { // acquire semaphore
f();
}

// release semaphore


... // more unguarded code
}

This code results in a deadlock because the interrupt task owns the semaphore,

thus function f() can never succeed in acquiring it. The Neuron firmware resolves

the deadlock by resetting the chip after the watchdog timer expires, but you must
be sure to release the semaphore before acquiring it again.
Defining a lock with target hardware or firmware that does not support

semaphores yields a linker error, NLD#506.

If you define a lock for an interrupt task that runs within the application

processor, the Neuron Exporter issue a warning message (NEX#4014) that the

hardware semaphore and the __lock{ } statement are not operational for the
specified system clock setting. In addition, when the interrupt task runs, no

semaphore is acquired, access is granted immediately, but a system error is
logged.

Advertising