I have an application that downloads data from the remote web server. This web server shuts down for maintenance at midnight for about ten minutes. So I need to disconnect from the server at 11:55pm and connect again at 12:05am. I use sockets so to disconnect I need to logout and close the socket, and to re-connect I need to open socket and logon. The part of my application that downloads data runs in its own thread.
So I need to stop the thread at 11:55pm and start at 12:05am. How do I do that efficiently?
If I use polling for system time until I get 11:55pm I am afraid polling will impede performance.
* Have you profiled a polling solution yet? If polling is the simplest, most easily maintained solution, then IMO it would be worth it to implement it and benchmark it against your needed performance criteria.