Since releasehw() is called after there is no hardware access, he is already synchronizing power/device state with the thread (assuming the threads needs to know about these state changes), otherwise the design is broken at a more fundamental level outside of system shutdown
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@flounder.com
Sent: Friday, September 28, 2012 12:31 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Regarding Win8 PrepareHardware and D0Exit
That was the answer I was thinking of giving, but I realized that it depends a lot on what the thread is doing. If the thread is actively processing some request, and shutdown terminates that activity before it has completed (say, the equivalent of lazy write-back), how would this be handled?
[I used to get a lot of questions of the form, “My application doesn’t free the memory it allocates, so when the process stops, do I leak memory?”]
joe
Your current design is fine. When the system is shut down, all devices
are powered off and existing threads go away when the machine turns off.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Friday, September 28, 2012 11:38 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Regarding Win8 PrepareHardware and D0Exit
Hi All
I have a legacy driver (Win7) which I am porting to Win8. In this
driver, a system thread is created using PsCreateSystemThread in the
PrepareHardware callback.
I noticed that the corresponding code to remove this thread is made in
the ReleaseHardware callback.
Now this leads to an issue. When I shutdown the system (by using
powercfg, disable hibernate, and calling shutdown), or when I simply
restart, ReleaseHardware is never called. This means that the System
Thread is never killed.
Would it be “legal” to put the code for killing the thread in D0Exit (
if the final state is D3Final) ? This does make the design look “asymmetric”
- PrepareHardware is called for creating the thread, but the removal
is done in D0Exit conditionally - but would this be considered good
or even acceptable design?
What is the general software design guidance for such cases ?
Thanks
Sharma
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer