INtime SDK Help
INtime SDK v7.1 > About INtime > INtime Kernel > Semaphores > CreateRtSemaphore

Creates a semaphore with the given initial and maximum number of units.

RTHANDLE CreateRtSemaphore(
    WORD wInitCount,        // initial unit count
    WORD wMaxCount,         // maximum unit count
    WORD wSemaphoreFlags    // creation flags


The initial number of units to be in the custody of the new semaphore.
The maximum number of units over which the new semaphore is to have custody at any given time.
Specifies flags that control the creation of the semaphore. Possible values are described below.
FIFO_QUEUING Specifies that threads are queued on a First-In-First-Out basis. This value is mutually exclusive with the PRIORITY_QUEUING value.
PRIORITY_QUEUING Specifies that the threads waiting on this object will be queued on a priority basis.

Return Values

A handle for the newly-created semaphore.
Failure. To determine the status, call GetLastRtError.


E_OK 0x0000
No exceptional conditions occurred.
E_MEM 0x0002
Creating a semaphore requires more available memory to the calling thread's process than currently exists.
E_LIMIT 0x0004
The calling thread's process reached its object limit.
E_SLOT 0x000C
You cannot create more RT objects because the GDT's slots are full.
E_PARAM 0x8004
One or more of these conditions exist:
  • wInitCount contains a value larger than wMaxCount.
  • wMaxCount contains the value 0 (zero).


Versions Defined in Include Link to
INtime 3.0 intime/rt/include/rtbase.h rt.h rt.lib

See Also

Semaphore system calls