网站首页  词典首页

请输入您要查询的函数:

 

术语 getthreadwaitchain
释义 GetThreadWaitChain
语法:
C++
BOOL WINAPI GetThreadWaitChain(
__in HWCT WctHandle,
__in_opt DWORD_PTR Context,
__in DWORD Flags,
__in DWORD ThreadId,
__inout LPDWORD NodeCount,
__out PWAITCHAIN_NODE_INFO NodeInfoArray,
__out LPBOOL IsCycle
);
GetThreadWaitChain功能
检索等待指定的线程链。
参数
WctHandle [in]
句柄了WCT届会议OpenThreadWaitChainSession函数创建。
上下文[中,可选]
对一个应用程序的指针定义的上下文结构传递给回调函数的一个异步会议。
标志 [in]
等待链的检索选项。此参数可以是下列值的之一。
ValueMeaning
WCT_OUT_OF_PROC_COM_FLAGEnumerates的出的进程内COM服务器的MTA找到一个正确的线程标识符的所有线程。
WCT_OUT_OF_PROC_CS_FLAGRetrieves关键其他进程的一节。
WCT_OUT_OF_PROC_FLAGFollows等待到其他进程链。否则,该函数在不同的报告过程中,第一个线程,但不检索更多的资料。
主题ID [in]
该线程的标识符。
NodeCount [ in , out ]
在输入,一个从1到WCT_MAX_NODE_COUNT,指定节点的等待链数目。在返回的节点数量检索。如果数组不能包含的所有等待链节点,函数失败,GetLastError返回ERROR_MORE_DATA,这个参数接收数组元素的数目必须包含所有的节点。
异步会议,检查传递给回调函数值。不自由的变量,直到回调函数返回。
NodeInfoArray [out]
一个WAITCHAIN_NODE_INFO结构的数组,它接收等待链。
异步会议,检查传递给回调函数值。不自由的数组,直到回调函数返回。
IsCycle [out]
如果该功能可以检测死锁,这个变量设置为TRUE,否则,它被设置为FALSE。
异步会议,检查传递给回调函数值。不自由的变量,直到回调函数返回。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。要检索扩展的错误信息,调用GetLastError。
返回codeDescription
ERROR_ACCESS_DENIEDThe调用方没有足够的权限打开一个目标线程。
输入参数的ERROR_INVALID_PARAMETEROne是无效的。
ERROR_IO_PENDINGThe WCT在会议开幕式异步模式。结果将返回通过WaitChainCallback回调函数。
ERROR_MORE_DATAThe NodeInfoArray缓冲区不够大,无法包含所有在等待链节点。该NodeCount参数包含的节点链中的数量。在等待链返回仍然是有效的。
ERROR_NOT_SUPPORTEDThe操作系统不提供这种服务。
ERROR_OBJECT_NOT_FOUNDThe指定的线程找不到。
ERROR_TOO_MANY_THREADSThe节点的人数超过WCT_MAX_NODE_COUNT。在等待链返回仍然是有效的。
备注
如果会话是异步的,则函数返回假,GetLastError返回ERROR_IO_PENDING。如果要取得的成果,看到WaitChainCallback回调函数。
如果指定的线程不会被阻止,或在一个不受支持的同步元素封锁,该函数返回一个NodeInfoArray单一项目。
调用者必须具有SE_DEBUG_NAME特权。如果调用方没有足够的权限,功能失败,如果一个线程不能访问。否则,数组中的最后一个节点将拥有ObjectStatus成员设置为WctStatusNoAcces。
如果任何节点的数组的子集形成一个循环,该函数设置IsCycle参数设置为TRUE。
等待链信息是动态的,它是正确时,调用函数,但可能是过时了,当它被调用审查时间。
实例
有关示例,请参阅使用WCT。
要求:
client最低支持Vista
server最低支持 Windows Server 2008
HeaderWct.h
LibraryAdvapi32.lib
DLLAdvapi32.dll
参见
OpenThreadWaitChainSession
等待链遍历
WAITCHAIN_NODE_INFO
WaitChainCallback
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==GetThreadWaitChain Function
Retrieves the wait chain for the specified thread.
Syntax
C++
BOOL WINAPI GetThreadWaitChain(
__in HWCT WctHandle,
__in_opt DWORD_PTR Context,
__in DWORD Flags,
__in DWORD ThreadId,
__inout LPDWORD NodeCount,
__out PWAITCHAIN_NODE_INFO NodeInfoArray,
__out LPBOOL IsCycle
);
Parameters
WctHandle [in]
A handle to the WCT session created by the OpenThreadWaitChainSession function.
Context [in, optional]
A pointer to an application-defined context structure to be passed to the callback function for an asynchronous session.
Flags [in]
The wait chain retrieval options. This parameter can be one of more of the following values.
ValueMeaning
WCT_OUT_OF_PROC_COM_FLAGEnumerates all threads of an out-of-proc MTA COM server to find the correct thread identifier.
WCT_OUT_OF_PROC_CS_FLAGRetrieves critical-section information from other processes.
WCT_OUT_OF_PROC_FLAGFollows the wait chain into other processes. Otherwise, the function reports the first thread in a different process but does not retrieve additional information.

ThreadId [in]
The identifier of the thread.
NodeCount [in, out]
On input, a number from 1 to WCT_MAX_NODE_COUNT that specifies the number of nodes in the wait chain. On return, the number of nodes retrieved. If the array cannot contain all the nodes of the wait chain, the function fails, GetLastError returns ERROR_MORE_DATA, and this parameter receives the number of array elements required to contain all the nodes.
For asynchronous sessions, check the value that is passed to the callback function. Do not free the variable until the callback function has returned.
NodeInfoArray [out]
An array of WAITCHAIN_NODE_INFO structures that receives the wait chain.
For asynchronous sessions, check the value that is passed to the callback function. Do not free the array until the callback function has returned.
IsCycle [out]
If the function detects a deadlock, this variable is set to TRUE; otherwise, it is set to FALSE.
For asynchronous sessions, check the value that is passed to the callback function. Do not free the variable until the callback function has returned.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To retrieve extended error information, call GetLastError .
Return codeDescription
ERROR_ACCESS_DENIEDThe caller did not have sufficient privilege to open a target thread.
ERROR_INVALID_PARAMETEROne of the input parameters is invalid.
ERROR_IO_PENDINGThe WCT session was opened in asynchronous mode. The results will be returned through the WaitChainCallback callback function.
ERROR_MORE_DATAThe NodeInfoArray buffer is not large enough to contain all the nodes in the wait chain. The NodeCount parameter contains the number of nodes in the chain. The wait chain returned is still valid.
ERROR_NOT_SUPPORTEDThe operating system is not providing this service.
ERROR_OBJECT_NOT_FOUNDThe specified thread could not be located.
ERROR_TOO_MANY_THREADSThe number of nodes exceeds WCT_MAX_NODE_COUNT. The wait chain returned is still valid.

Remarks
If the session is asynchronous, the function returns false and GetLastError returns ERROR_IO_PENDING. To obtain the results, see the WaitChainCallback callback function.
If the specified thread is not blocked or is blocked on an unsupported synchronization element, the function returns a single item in NodeInfoArray.
The caller must have the SE_DEBUG_NAME privilege. If the caller has insufficient privileges, the function fails if the first thread cannot be accessed. Otherwise, the last node in the array will have its ObjectStatus member set to WctStatusNoAcces.
If any subset of nodes in the array forms a cycle, the function sets the IsCycle parameter to TRUE.
Wait chain information is dynamic; it was correct when the function was called but may be out-of-date by the time it is reviewed by the caller.
Examples
For an example, see Using WCT .
Requirements
Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2008
HeaderWct.h
LibraryAdvapi32.lib
DLLAdvapi32.dll
See Also
OpenThreadWaitChainSession
Wait Chain Traversal
WAITCHAIN_NODE_INFO
WaitChainCallback
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms679364(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 11:30:43