INtime SDK Help
CreateRtSemaphore
INtime SDK v7 > 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
);

Parameters

wInitCount
The initial number of units to be in the custody of the new semaphore.
wMaxCount
The maximum number of units over which the new semaphore is to have custody at any given time.
wSemaphoreFlags
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.
Success.
BAD_RTHANDLE
Failure. To determine the status, call GetLastRtError.

Status

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).

Requirements

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

See Also

Semaphore system calls