B.3.6 Blocking Primitives for Open and Close Procedures

Instead of calling KeWaitForMutexObject, KeWaitForMultipleObjects, and KeWaitForSingleObject, a STREAMS stack must use the following corresponding functions, each of which has a queue pointer as the first parameter:

·StrmWaitForMutexObject

·StrmWaitForMultipleObjects

·StrmWaitForSingleObject

StrmWaitForMutexObject

The function StrmWaitForMutexObject allows the calling routine to wait until the specified mutex object attains a signaled state.

NTSTATUS

StrmWaitForMutexObject(

IN queue_t *Queue,

IN PKMUTEX Mutex,

IN KWAIT_REASON WaitReason,

IN KPROCESSOR_MODE WaitMode,

IN BOOLEAN Alertable,

IN PLARGE_INTEGER Timeout OPTIONAL

);

Parameters

Queue

Points to the queue of the calling open or close routine.

Mutex

Points to the mutex object for which to wait.

WaitReason

Specifies the reason for waiting.

WaitMode

Specifies the processor wait mode to be used.

Alertable

Specifies if the wait is alertable.

Timeout

Optionally points to the timeout period.

StrmWaitForMultipleObjects

The function StrmWaitForMultipleObjects allows the calling routine to wait until the specified objects attain a signaled state.

NTSTATUS

StrmWaitForMultipleObjects(

IN queue_t *Queue,

IN CCHAR Count,

IN PVOID Object[],

IN WAIT_TYPE WaitType,

IN KWAIT_REASON WaitReason,

IN KPROCESSOR_MODE WaitMode,

IN BOOLEAN Alertable,

IN PLARGE_INTEGER Timeout OPTIONAL,

IN PKWAIT_BLOCK WaitBlockArray OPTIONAL

);

Parameters

Queue

Points to the queue of the calling open or close routine.

Count

Specifies the number of objects for which to wait.

Object[]

Points to an array of pointers to dispatcher objects.

WaitType

Specifies the wait type (WaitAll or WaitAny).

WaitReason

Specifies the reason for waiting.

WaitMode

Specifies the processor wait mode to be used.

Alertable

Specifies if the wait is alertable.

Timeout

Optionally points to the timeout period.

WaitBlockArray

Optionally points to an array of wait blocks.

StrmWaitForSingleObject

The function StrmWaitForSingleObject allows the calling routine to wait until the specified object attains a Signaled state.

NTSTATUS

StrmWaitForSingleObject(

IN queue_t *Queue,

IN PVOID Object,

IN KWAIT_REASON WaitReason,

IN KPROCESSOR_MODE WaitMode,

IN BOOLEAN Alertable,

IN PLARGE_INTEGER Timeout OPTIONAL

);

Parameters

Queue

Points to the queue of the calling open or close routine.

Object

Points to the dispatcher object.

WaitReason

Specifies the reason for waiting.

WaitMode

Specifies the processor wait mode to be used.

Alertable

Specifies if the wait is alertable.

Timeout

Optionally points to the timeout period.