// storport.h
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
);
View the official Windows Driver Kit DDI referenceNo description available.
StorPortCreateSystemThread creates a system thread and supplies a pointer to a context for the thread.
HwDeviceExtension [in]Pointer to the miniport's hardware device extension.
StartRoutine [in]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.
StartContext [in/optional]Pointer to a single argument that is passed to the thread when it begins execution.
Priority [in/optional]Pointer to a STOR_THREAD_PRIORITY enum value that specifies the thread priority.
ThreadContext [out/optional]Pointer to a variable that will receive the thread context.
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. |
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.