SIGINT signal handler for perl-Glib



Hello,

I'm trying to interface a Glib2-based C/C++ library (call it <app>) to Perl. Does it make sense to use 
perl-Glib for the Glib part and SWIG (for the <app>part)? This would let me write Perl code like:

use Glib;
use <app-lib>;

__app_init();
$loop = Glib::MainLoop->new();
$loop->run();
...

The issue I've run into is how to shutdown gracefully and clean up the app when the user sends a SIGINT or 
SIGHUP. The  app code does it by setting up a signal handler for those 2 signals which overrides the ones in 
libglib2 (it also does a mainloop->quit). 

When I tried setting a signal handler in Perl:
$SIG{INT} = \&app_cleanup, the script did not respond, probably because the handler in the perl-Glib library 
cannot be overridden? Is it possible to pick up an event that will be called after the default sigint handler 
exits? If I've missed something in the docs, please point me to an example.

Thanks
Sameer






Need a new email address that people can remember
Check out the new EudoraMail at
http://www.eudoramail.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]