Creates 1 of 3 kinds of low-level semaphores with 0 or 1 initial units. FIFO and priority semaphores can contain as many as 65,535 units, which are placed in the semaphore by using multiple calls to knReleaseRtSemaphore, 1 call for each unit.
If a low-level region is created with 0 units, the creating thread holds the region's unit and is therefore the owning thread.
If a low-level region is created with 1 unit, no thread owns the region until it invokes knWaitForRtSemaphore for that region.
This call is non-scheduling and is safe, but not recommended, for use by interrupt handlers.
KNHANDLE knCreateRtSemaphore( KNPTR lpSemaporeArea, // pointer to low-level semaphore area DWORD dwSemaphoreFlags // low-level semaphore flags );
lpSemaphoreArea
dwSemaphoreFlags
KN_EXCH_TYPE_MASK |
Masks the queuing strategy field. Choose one of the following:
|
KN_INITIAL_SEM_STATE_MASK |
Masks the number of initial units the semaphore receives. Choose one of these literals:
|
Note:
- KN_FIFO_QUEUING , KN_PRIORITY_QUEUING , and KN_REGION are mutually exclusive.
- KN_ZERO_UNITS and KN_ONE_UNIT are mutually exclusive.
- You must OR multiple literals together to produce the
dwSemaphoreFlags
value passed by the call.
Success: a handle for the low-level semaphore.
Failure: the value 0xffffffff is returned if the lpSemaporeArea pointer was not valid, or if the maximum number of semaphore mappings for the process has been exceeded.
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/rtbase.h | rt.h | rt.lib |