Re: When to disable/enable APCs?
- From: "Skywing [MVP]" <skywing_NO_SPAM_@xxxxxxxxxxxxxxxxxxx>
- Date: Sat, 22 Jul 2006 11:22:55 -0400
This documentation is just plain wrong. Ctrl+C is handled entirely in user
mode; CSRSS creates a thread in the process receiving the Ctrl+C event that
calls a handler function in kernel32. This handler function calls the list
of registered handlers that applications have registered with kernel32 and
possibly performs the default action for Ctrl+C (killing the app).
There is no special kernel mode logic to support this. I don't know where
that particular piece of documentation originated, but as far as I know the
reality is that Ctrl+C is an entirely user mode concept handled by CSRSS.
--
Ken Johnson (Skywing)
Windows SDK MVP
"Steve Dispensa" <dispensa@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:C0E70412.15716%dispensa@xxxxxxxxxxxxxxxxxxxxxxx
No, it doesn't, ctrl+c is special:
"The Alertable parameter specifies whether the thread can be alerted and
its
wait state aborted by an alert originating from an undocumented internal
kernel routine or by a user-mode APC. If the value of Alertable is FALSE
then the thread cannot be alerted, no matter what the value of the
WaitMode
parameter or the origin of the alert. The only exception to this rule is
that of a terminating thread. A thread is automatically made alertable,
for
instance, when terminated by a user with a Ctrl+C."
Reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/kernel_d/hh
/Kernel_d/Synchro_c88e3997-b7c1-494d-983b-2a69b229a904.xml.asp
There is a good paper with some relevant commentary here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndevice/ht
ml/Locks_Sync.asp
-Steve
On 7/21/06 8:10 PM, in article qlu2c2t0andn07ovqdcbsjaci58ku6mi74@xxxxxxx,
"BubbaGump" <BubbaGump> wrote:
Never mind this one. Sorry. I think I know the answer, that it
depends on whether a wait is alertable or not.
On Fri, 21 Jul 2006 20:45:54 -0400, BubbaGump <> wrote:
Speaking of disabling a thread (suspending or killing?), what happens
to the thread of a command-line application if someone presses CTRL-C
while it's waiting on a lock? Is the CTRL-C ignored, processed
immediately, or processed after the lock is acquired?
On Fri, 21 Jul 2006 17:00:13 -0700, "Doron Holan [MS]"
<doronh@xxxxxxxxxxxxxxxxxxxx> wrote:
typically you leave APCs enabled. you disalbe them when you are
holding a
lock while still at passive level. for instance, if you are using a
KEVENT
to synchronize access, you want to disable APCs before acquiring it.
the
reason you disable APCs inthis case is that the thread can be disabled
(via
an APC) while holding the lock and never resumed, thus orphaning the
lock
d
.
- Follow-Ups:
- Re: When to disable/enable APCs?
- From: Maxim S. Shatskih
- Re: When to disable/enable APCs?
- From: Ali
- Re: When to disable/enable APCs?
- References:
- Re: When to disable/enable APCs?
- From: Maxim S. Shatskih
- Re: When to disable/enable APCs?
- From: Doron Holan [MS]
- Re: When to disable/enable APCs?
- From: BubbaGump
- Re: When to disable/enable APCs?
- From: Steve Dispensa
- Re: When to disable/enable APCs?
- Prev by Date: Re: When to disable/enable APCs?
- Next by Date: Re: Windows Vista & ACPI
- Previous by thread: Re: When to disable/enable APCs?
- Next by thread: Re: When to disable/enable APCs?
- Index(es):
Relevant Pages
|