OSA : OS_IsInCriticalSection

bool OS_IsInCriticalSection ()

Returns true if program is in critical section.

Call allowed:

Everywhere

Parameters:

None

Returns:

false program is not in critical section
true program is in critical section

Example:

void Task (void)
{
    for (;;) {
        /*...*/
        if (!OS_IsInCriticalSection()) {
            OS_Bsem_Wait(1);       // wait for semaphore only when we are not in critical section
        };
        /*...*/
    }
}

See also