I'm writing a server application (my first one) and I've come across a problem. I would like to make sure that every destructor is called on shut-down (saving data,..) and so I'm handling process signals. However, when my thread enters the blocking accept call, it obviously won't exit until a connection is accepted.
How should I go about implementing this? I would prefer if I could simply indicate whether to enter blocking accept by a variable, but that is probably not possible (or desirable with regards to how the application should run). Is the best way to use select (creating a temporary file that will be writen to when a signal is caught)?