my software prevents windows from shutting down

  • Thread starter Thread starter sanket gupta
  • Start date Start date
S

sanket gupta

Hi guys ,
I face a peculiar problem.
I have a mutithreaded software trhat uses sockets to connect to my
webserver.
The problem is that while my software is running , windows is unable to
reboot/logoff or shut down.
I have to shut down the software before windows can do this.
Any suggestions on why this could be happening?
Thanks/Regards
Sanket Gupta
 
sanket said:
The problem is that while my software is running , windows is unable
to reboot/logoff or shut down.
I have to shut down the software before windows can do this.
Any suggestions on why this could be happening?

I have no idea what can be causing this, but it's damn funny :))).
Anyway, I think you could try to catch the shutdown message and close
all sockets, threads, handles, etc in your handler and then terminate
the application. It's just a wild guess and of course an workarround
not a solution, but could help.

Christina Androne
 
sanket said:
Hi guys ,
I face a peculiar problem.
I have a mutithreaded software trhat uses sockets to connect to my
webserver.
The problem is that while my software is running , windows is unable
to reboot/logoff or shut down.

Second though: are you having a loop where a socket listens and listens
and listens and never ends?

Christina Androne
 
Your program has to process WM_QUERYSHUTDOWN and WM_SHUTDOWN messages
correctly.

I believe what happens in your case - you answer "yes" on queryshutdown,
system proceeds with shutdown, sends shutdown and your program can not quit
because one of the threads is in some loop or wait function waiting for
messages through socket.
You should think of a mechanism to wake that thread up and tell it to exit
or answer "no" to queryshutdown.
Killing a thread is also an option but not so pretty one.

Search for information about these messages in MSDN.
 
Thanks guys.
You gave me ahint and rest of the work was done by google whcih gave me
more hints and finally i could solve the problem.
thanks a lot
 
Back
Top