Michael Ost most@museresearch.com writes:
I would like my Winelib application to do a normal shutdown from a signal, that is save files and exit normally.
From scanning the web SIGTERM seems like the natural choice. It looks
like it is _supposed_ to be used for a normal exit. But Wine seems to reserve SIGTERM for a summary execution with pthread_abort.
It looks like I could use SIGQUIT, since Wine doesn't seem to care about it. But, again from scanning the web, SIGQUIT is _supposed_ to be used for non-normal exits.
So, is it best to use SIGQUIT in a non-canonical way or try to change how SIGTERM is handled by Wine and make it more canonical? Or maybe my reading of the "canon of signals" is incorrect?
SIGTERM in Wine corresponds to TerminateThread, which is the standard way to kill a thread in Win32, so it sounds very much canonical, I don't think you want to change it.
You can certainly use SIGQUIT, but if you are defining your own mechanism, using signals is probably not the best choice. Cleaning up properly on a signal is pretty hard to do right, and even harder in Wine since we use signals for our own purposes.