On Thu, Jul 21, 2005 at 03:39:46AM +0200, Jochen Baier wrote: > hi, > > i wonder what is the right procedure to do some cleanup if the user > logout from session > and the program is still alive. ("Save file before exit" etc) > > I thought "system (SIGHUP,...)" is the right way, but i didnt find this > function in code from gedit, anjuta etc.. so what is the right way to > do this ? as far as I know glib and gdk/gtk haven't added any support for signal handling, so I imagine using sigaction() and associated POSIX functions are what you'd want to use. (what is this system(SIGHUP,...) of which you speak? never heard of it.) the only thing I'm aware of that needs to be said about signal handling in relation to gtk is about dealing with asynchronous nature of signals. gtk assumes it knows everything about what threads are running. if you start executing gtk code during a signal handler, you run the (very probable) risk of making gtk stomp on itself when your handler runs on top of what gtk thinks is a thread-autonomous operation. I'm not sure exactly what mechanism to use... but the best way to handle signals is to make the actual signal handler do something very simple and non-gtk-interactive/invasive like setting some kind of simple flag -- THEN engineer some way for the gtk main loop to respond to that flag being set. make sense? - Ben _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list