OSA : OS_Csem_Create

OS_Csem_Create (csem)

Not allowed in interrupt

Create counting semaphore. After creation semaphore's value is zero.

OS_ENABLE_CSEM constant must be defined in OSAcfg.h. Size of counting semaphores is defined by OS_CSEM_SIZE constant

For PIC16, counting semaphores can only be allocated in bank0 or bank1

Call allowed:

Not in interrupt

Parameters:

csem Counting semaphore. Variable of OST_CSEM type

Returns:

nothing

Example:

OST_CSEM csem;
 
void Task (void)
{
    OS_Csem_Create (csem);      // Create semaphore to work with it
    for (;;) {
        /*...*/
    }
}

Old style name

OS_CreateCSem

See also