SuspendThread

SuspendThread suspends the specified thread.

Syntax

Copy
DWORD SuspendThread(
    HANDLE hThread
);

Parameters

hThread

The thread to suspend.

Return Value

If the function succeeds, it returns the thread's previous suspend count; if the function fails, it returns 0XFFFFFFFF.

To get extended error information, use GetLastError.

Remarks

If the function succeeds, execution of the specified thread is suspended, and the thread's suspend count is raised by one.

Suspending a thread causes the thread to stop executing.

Each thread has a suspend count (with a maximum value of MAXIMUM_SUSPEND_COUNT). If the suspend count is greater than zero, the thread is suspended; otherwise, the thread is not suspended and is eligible for execution. Calling SuspendThread causes the target thread's suspend count to be raised by one. Attempting to increment past the maximum suspend count causes an error without incrementing the count.

ResumeThread decrements the suspend count of a suspended thread.

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

windows.h rtkrnl.lib

See Also: