Expand Minimize

KeInitializeSemaphore routine

The KeInitializeSemaphore routine initializes a semaphore object with a specified count and specifies an upper limit that the count can attain.

Syntax


VOID KeInitializeSemaphore(
  _Out_ PRKSEMAPHORE Semaphore,
  _In_  LONG         Count,
  _In_  LONG         Limit
);

Parameters

Semaphore [out]

Pointer to a dispatcher object of type semaphore, for which the caller provides the storage.

Count [in]

Specifies the initial count value to be assigned to the semaphore. This value must be positive. A nonzero value sets the initial state of the semaphore to signaled.

Limit [in]

Specifies the maximum count value that the semaphore can attain. This value must be positive. It determines how many waiting threads become eligible for execution when the semaphore is set to the signaled state and can therefore access the resource that the semaphore protects.

Return value

None

Remarks

The semaphore object is initialized with the specified initial count and limit.

Storage for a semaphore object must be resident: in the device extension of a driver-created device object, in the controller extension of a driver-created controller object, or in nonpaged pool allocated by the caller.

For more information about semaphore objects, see Semaphore Objects.

Requirements

Target platform

Universal

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

PASSIVE_LEVEL

DDI compliance rules

IrqlKeDispatchLte, PowerIrpDDis, HwStorPortProhibitedDDIs

See also

KeReadStateSemaphore
KeReleaseSemaphore
KeWaitForMultipleObjects
KeWaitForSingleObject

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft