网站首页  词典首页

请输入您要查询的函数:

 

术语 queueuserapc
释义 QueueUserAPC
语法:
C++
DWORD WINAPI QueueUserAPC(
__in PAPCFUNC pfnAPC,
__in HANDLE hThread,
__in ULONG_PTR dwData
);
QueueUserAPC功能
增加一个用户模式异步过程调用(APC)反对指定的线程apc的队列。
参数
pfnAPC [in]
该申请的指针提供的APC功能时调用指定的线程执行一个可报警等待操作。有关更多信息,请参阅APCProc。
hThread [in]
句柄到线程。句柄必须有THREAD_SET_CONTEXT访问权限。有关更多信息,请参阅同步对象的安全和访问权限。
dwData [in]
一个值传递给APC功能指向的pfnAPC参数。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。没有这个值可以通过调用GetLastError函数检索功能定义的错误。
备注
APC的支持操作系统提供允许应用程序队列的APC对象线程。的APC队列可以从64位进程到另一个64位进程或从32位进程到另一个32位进程。您不应该从一个队列64位进程的APC的32位进程,反之亦然,因为该地址将不正确的应用程序会崩溃。
每个线程都有自己的apc的队列。在排队的APC是一个请求的线程调用APC的功能。经营体制若干问题的软件中断线程直接调用APC的功能。
当一个用户模式APC是排队,不针对线程调用APC功能,除非它在可报警状态。线程后,在第一线处理所有悬而未决的装甲运兵车先出(FIFO)的订单,以及等待操作返回WAIT_IO_COMPLETION在一个可报警状态。线程进入使用SleepEx,SignalObjectAndWait,WaitForSingleObjectEx,WaitForMultipleObjectsEx,或MsgWaitForMultipleObjectsEx执行一个报警等待行动,可报警状态。
如果应用程序线程队列前开始运行的APC的线程开始通过调用APC的功能。当线程调用一个APC的功能,它要求在其apc的队列中的所有装甲运兵车APC的功能。
这是可能的休眠或等待在APC对象。如果您执行内部的APC报警等待,它会递归派出装甲运兵车。这可能会导致堆栈溢出。
当线程终止使用ExitThread或TerminateThread函数,在其apc的队列中的装甲运兵车都将丢失。 APC的功能不叫。
请注意,ReadFileEx,SetWaitableTimer,和WriteFileEx功能是使用的完成通知回调机制的APC。
要编译的应用程序使用此功能,定义_WIN32_WINNT为0x0400或更高版本。有关详细信息,请参阅使用Windows头。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
APCProc
异步过程调用
同步功能
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==QueueUserAPC Function
Adds a user-mode asynchronous procedure call (APC) object to the APC queue of the specified thread.
Syntax
C++
DWORD WINAPI QueueUserAPC(
__in PAPCFUNC pfnAPC,
__in HANDLE hThread,
__in ULONG_PTR dwData
);
Parameters
pfnAPC [in]
A pointer to the application-supplied APC function to be called when the specified thread performs an alertable wait operation. For more information, see APCProc .
hThread [in]
A handle to the thread. The handle must have the THREAD_SET_CONTEXT access right. For more information, see Synchronization Object Security and Access Rights .
dwData [in]
A single value that is passed to the APC function pointed to by the pfnAPC parameter.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. There are no error values defined for this function that can be retrieved by calling GetLastError .
Remarks
The APC support provided in the operating system allows an application to queue an APC object to a thread. An APC can be queued from a 64-bit process to another 64-bit process or from a 32-bit process to another 32-bit process. You should not queue an APC from a 64-bit process to a 32-bit process or vice versa, because the address will be incorrect and the application will crash.
Each thread has its own APC queue. The queuing of an APC is a request for the thread to call the APC function. The operating system issues a software interrupt to direct the thread to call the APC function.
When a user-mode APC is queued, the thread is not directed to call the APC function unless it is in an alertable state. After the thread is in an alertable state, the thread handles all pending APCs in first in, first out (FIFO) order, and the wait operation returns WAIT_IO_COMPLETION. A thread enters an alertable state by using SleepEx , SignalObjectAndWait , WaitForSingleObjectEx , WaitForMultipleObjectsEx , or MsgWaitForMultipleObjectsEx to perform an alertable wait operation.
If an application queues an APC before the thread begins running, the thread begins by calling the APC function. After the thread calls an APC function, it calls the APC functions for all APCs in its APC queue.
It is possible to sleep or wait for an object within the APC. If you perform an alertable wait inside an APC, it will recursively dispatch the APCs. This can cause a stack overflow.
When the thread is terminated using the ExitThread or TerminateThread function, the APCs in its APC queue are lost. The APC functions are not called.
Note that the ReadFileEx , SetWaitableTimer , and WriteFileEx functions are implemented using an APC as the completion notification callback mechanism.
To compile an application that uses this function, define _WIN32_WINNT as 0x0400 or later. For more information, see Using the Windows Headers .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
APCProc
Asynchronous Procedure Calls
Synchronization Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms684954(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:27:23