Hi,
If LCK_pend times out should LCK_post be cleared?
In other words, should I write:
if (LCK_pend(&lock, 10))
{
...
LCK_post(&lock);
}
or:
if (LCK_pend(&lock, 10))
{
...
}
LCK_post(&lock);
Thanks,
Matt
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
The former. From the DSP/BIOS API Reference Guide (spru403):
LCK_pend returns TRUE if it successfully acquires ownership of lock,
returns FALSE if a timeout occurs before it can acquire ownership.
LCK_pend returns FALSE if it is called from the context of a SWI or HWI,
even if the timeout is zero.
In other words, if LCK_pend returns FALSE, you do not "own" the lock, so you cannot "relinquish" ownership via LCK_post.
Mark