网站首页  词典首页

请输入您要查询的函数:

 

术语 suspendthread
释义 SuspendThread
语法:
C++
DWORD WINAPI SuspendThread(
__in HANDLE hThread
);
SuspendThread函数
挂起指定的线程。
64位应用程序可以暂停线程的WOW64使用Wow64SuspendThread功能。
参数
hThread [in]
句柄的线程被挂起。
句柄必须有THREAD_SUSPEND_RESUME访问权限。有关更多信息,请参见线程安全和访问权限。
返回值
如果函数成功,返回值是线程的前暂停计数,否则,它是(DWORD值)-1。为了获得更多错误信息,使用GetLastError函数。
备注
如果函数成功,在指定的线程的执行暂停线程的挂起计数递增。暂停一个线程会导致线程停止执行用户模式(应用程序)代码。
此功能主要是用来通过调试器使用。它不是为了用于线程同步使用。一个线程上调用拥有同步对象,如互斥或关键部分,SuspendThread,可能导致僵局如果调用线程试图获得一个同步对象由一个线程拥有暂停。为了避免这种状况,在一个应用程序,不是一个调试器的信号另一个线程暂停自己的线程。目标线程的设计必须留意这个信号,并作出适当的反应。
每个线程都有一个暂停计数(并MAXIMUM_SUSPEND_COUNT最大值)。如果暂停计数大于零,该线程被挂起,否则线程并未中止,负责执行的资格。调用SuspendThread导致目标线程的暂停计数递增。过去的最高试图暂停计数递增而递增的原因计数错误。
该ResumeThread函数递减挂起一个挂起的线程数。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
OpenThread
进程和线程函数
ResumeThread
暂停线程的执行
主题
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==SuspendThread Function
Suspends the specified thread.
A 64-bit application can suspend a WOW64 thread using the Wow64SuspendThread function.
Syntax
C++
DWORD WINAPI SuspendThread(
__in HANDLE hThread
);
Parameters
hThread [in]
A handle to the thread that is to be suspended.
The handle must have the THREAD_SUSPEND_RESUME access right. For more information, see Thread Security and Access Rights .
Return Value
If the function succeeds, the return value is the thread's previous suspend count; otherwise, it is (DWORD) -1. To get extended error information, use the GetLastError function.
Remarks
If the function succeeds, execution of the specified thread is suspended and the thread's suspend count is incremented. Suspending a thread causes the thread to stop executing user-mode (application) code.
This function is primarily designed for use by debuggers. It is not intended to be used for thread synchronization. Calling SuspendThread on a thread that owns a synchronization object, such as a mutex or critical section, can lead to a deadlock if the calling thread tries to obtain a synchronization object owned by a suspended thread. To avoid this situation, a thread within an application that is not a debugger should signal the other thread to suspend itself. The target thread must be designed to watch for this signal and respond appropriately.
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 incremented. Attempting to increment past the maximum suspend count causes an error without incrementing the count.
The ResumeThread function decrements the suspend count of a suspended thread.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
OpenThread
Process and Thread Functions
ResumeThread
Suspending Thread Execution
Threads
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms686345(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:16:21