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?