[KERNEL32] Minor enhancements for CreateRemoteThread(). (#804)
[reactos.git] / media / doc / apc
1 APC
2
3 Asynchronous procedure call
4
5 An APC is a Kernel-defined control object representing a procedure
6 that is called asynchronously. APCs are thread-context dependent; that
7 is, they are queued to a particular thread for execution.
8
9 There are three different kinds of APCs in NT:
10
11 User APCs are used by certain asynchronous NT system services to allow
12 user-mode applications or protected subsystems to synchronize the
13 execution of a thread with the completion of an operation or the
14 occurrence of an event such as a timers expiration. User APCs are, by
15 default, disabled. That is, they are queued to the user-mode thread,
16 but they are not executed except at well-defined points in the
17 program. Specifically, they can only be executed when an application
18 or protected subsystem has called a wait service and has enabled
19 alerts to occur, or if it has called the test-alert service.
20
21 Kernel APCs are normal kernel-mode APCs. They are much like a normal
22 user APC except that they are executable by default. That is, they are
23 enabled except when the thread is already executing a Kernel APC.
24 (Note that a special Kernel APC always preempts these.)
25
26 Special Kernel APCs cannot be blocked except by running at a raised
27 IRQL. They are executed at APC_LEVEL IRQL (see IDT), in kernel mode.
28 These types of APCs are used by the system to force a thread to
29 execute a procedure in the threads context. An example of this is I/O
30 completion: the I/O Manager needs to get back into the context of the
31 original requestor of the I/O operation so that it can copy buffers,
32 and so forth. In order to do this, the I/O Manager must be able to
33 access the virtual address space of the thread/process, and the most
34 efficient way to complete the operation is to be in the calling
35 threads context.
36