OSA : OS_Bsem_Check

OST_WORD OS_Bsem_Check (bsem)
OST_WORD bool OS_Bsem_Check_I (bsem)

Check if binary semaphore is set. Returns value of type OST_WORD.

Call allowed:

Everywhere

Parameters:

bsem Binary semaphore's ID. Number of binary semaphores is set by OS_BSEMS constant in OSAcfg.h

Returns:

==0 Semaphore is not set
!=0 Semaphore is set

Example:

#define BS_DATA_RECEIVED  3
 
void Task (void)
{
    for (;;) {
        /*...*/
        // Is semaphore set by other task?
        if (OS_Bsem_Check(BS_DATA_RECEIVED)) {
            // Work with received data
            /*...*/
        }
        /*...*/
    }
}

Old style name

OS_CheckBSem

See also