OSTaskSemSet()
OS_SEM_CTR OSTaskSemSet (OS_TCB *p_tcb,
OS_SEM_CTR cnt;
OS_ERR *p_err)
File |
Called from |
Code enabled by |
os_task.c |
Task or ISR |
Always Enabled |
OSTaskSemSet() allows the user to set the value of the task’s signal counter. You would set the signal counter of the calling task by passing a NULL pointer for p_tcb.
Arguments
p_tcb
is a pointer to the task’s OS_TCB to clear the signal counter. A NULL pointer indicates that the user wants to clear the caller’s signal counter.
cnt
the desired value for the task semaphore counter.
p_err
is a pointer to a variable that will contain an error code returned by this function.
Returned Value
The value of the signal counter prior to setting it.
Notes/Warnings
None
Example
OS_TCB TaskY;
void TaskX (void *p_arg) { OS_ERR err;
while (DEF_ON) { : : OSTaskSemSet(&TaskY, 0, &err); /* Check “err” */ : : } } |