StorPortCreateSystemThread function (storport.h)

StorPortCreateSystemThread creates a system thread and supplies a pointer to a context for the thread.

Syntax

ULONG StorPortCreateSystemThread(
  [in]           PVOID                      HwDeviceExtension,
  [in]           PSTOR_THREAD_START_ROUTINE StartRoutine,
  [in/optional]  PVOID                      StartContext,
  [in/optional]  PSTOR_THREAD_PRIORITY      Priority,
  [out/optional] PVOID                      *ThreadContext
);

Parameters

[in] HwDeviceExtension

Pointer to the miniport's hardware device extension.

[in] StartRoutine

Pointer to the entry point for the newly created system thread. This parameter is a function pointer to a STOR_THREAD_START_ROUTINE callback that receives a single argument, which is the StartContext parameter value.

[in/optional] StartContext

Pointer to a single argument that is passed to the thread when it begins execution.

[in/optional] Priority

Pointer to a STOR_THREAD_PRIORITY enum value that specifies the thread priority.

[out/optional] ThreadContext

Pointer to a variable that will receive the thread context.

Return value

StorPortCreateSystemThread returns one of the following values:

Return code Description
STOR_STATUS_SUCCESS A system thread has been successfully created.
STOR_STATUS_INVALID_PARAMETER One or more of the provided parameters are invalid.
STOR_STATUS_UNSUCCESSFUL Returned for other internal system reasons.

Remarks

Miniport drivers that create device-dedicated threads call StorPortCreateSystemThread, either when they initialize or when I/O requests begin to come in to the driver's Dispatch routines. For example, a driver might create such a thread when it receives an asynchronous device control request.

The thread continues to run until either the system is shut down or the thread terminates itself by calling StorPortTerminateSystemThread.

Thread priority can be changed by calling StorPortSetPriorityThread. A miniport should specify a thread priority value that avoids run-time priority inversions. See Device-dedicated Threads for more information.

For a given adapter, the maximum system threads that a miniport can create is the maximum logical processor count in the system.

Requirements

Requirement Value
Minimum supported server Windows Server 2022
Header storport.h

See also

STOR_THREAD_PRIORITY

STOR_THREAD_START_ROUTINE

StorPortSetPriorityThread

StorPortTerminateSystemThread