I have written a user mode application which has a main thread and that thread creates a child thread. The child thread makes an IOCTL call and waits in the kernel driver on a wait event. When the execution reaches the end of application, I see the app just hangs forever. Looking at the pending call stacks, I see only the child thread waiting on the event and the main thread has exited cleanly. The child thread is waiting on an event like this:
When the app is going to terminate, shouldn’t the child thread waiting on the event get alerted since I have set Alertable = TRUE? Once I receive the STATUS_ALERTED return value, I will go ahead and terminate the child thread as well. But for some reason, the child thread is not coming out of wait. Is there anything that I am missing?
On Jan 10, 2018, at 8:57 PM, xxxxx@gmail.com wrote: > > I have written a user mode application which has a main thread and that thread creates a child thread. The child thread makes an IOCTL call and waits in the kernel driver on a wait event.
That’s not a good design, for exactly this reason. Can’t you just submit an ioctl, pend it in the driver, and have the user-mode thread wait on the event? — Tim Roberts, xxxxx@probo.com Providenza & Boekelheide, Inc.
________________________________ From: xxxxx@lists.osr.com on behalf of xxxxx@gmail.com Sent: Wednesday, January 10, 2018 11:57:11 PM To: Windows System Software Devs Interest List Subject: [ntdev] User Mode Application never exits
Hi,
I have written a user mode application which has a main thread and that thread creates a child thread. The child thread makes an IOCTL call and waits in the kernel driver on a wait event. When the execution reaches the end of application, I see the app just hangs forever. Looking at the pending call stacks, I see only the child thread waiting on the event and the main thread has exited cleanly. The child thread is waiting on an event like this:
When the app is going to terminate, shouldn’t the child thread waiting on the event get alerted since I have set Alertable = TRUE? Once I receive the STATUS_ALERTED return value, I will go ahead and terminate the child thread as well. But for some reason, the child thread is not coming out of wait. Is there anything that I am missing?