Maxim
Wed Aug 29 05:35:24 CDT 2007
KernelMode/Alertable = FALSE - wait cannot be interrupted
UserMode/Alertable = FALSE - wait can be interrupted only by the
termination of the process owning the thread.
KernelMode/Alertable = TRUE - don't know
UserMode/Alertable = TRUE - wait can be interrupted by the termination of
the process owning the thread, as also by a user APC.
The return values of "the wait was interrupted" are STATUS_ALERTED or
STATUS_USER_APC.
About the related topic of Ctrl-C: it works by CSRSS making a remote thread
inside the client process, and this injected thread calls the handler, the
default is ExitProcess.
About waits in synchronous IO calls: they are by default non-alertable,
thus, the IO wait can be interrupted only by process termination.
This is because Win32's CreateFile provides FILE_SYNCHRONOUS_IO_NONALERT to
ZwCreateFile. You can try calling ZwCreateFile with FILE_SYNCHRONOUS_IO_ALERT,
in which case theoretically the IO waits will be interruptable by APCs.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
"xmllmx" <xmllmx@gmail.com> wrote in message
news:1188342965.566835.172820@x35g2000prf.googlegroups.com...
> Hi all,
>
> The DDK documetation says:
>
> "If the value of Alertable is TRUE and one of the following conditions
> is present, the thread will be alerted:
>
> 1, If the origin of the alert is an internal, undocumented kernel-mode
> routine used to alert threads.
>
> 2, The origin of the alert is a user-mode APC, and the value of the
> WaitMode parameter is UserMode.
>
> In the first of these two cases, the thread's wait is satisfied with a
> completion status of STATUS_ALERTED; in the second case, it is
> satisfied with a completion status of STATUS_USER_APC."
>
> However, the parameters passed into KeDelayExecutionThread doesn't
> include any dispatcher object such as event, semaphore, mutex, etc. My
> question is: By which dispatcher object does current sleeping thread
> get alerted? Except by user APC.
>
> Thanks in advance.
>