Reputation: 81
I have very simple constructor and destructor for some C-based library. Well, i need to catch signals like TERM and others to enforce destructor calling on perl's mandatory death with killall perl
e.g.
In fact i need local $SIG{TERM} for each object to be installed, written inside XS constructor. Is it possible?
!thanx!
Upvotes: 2
Views: 171
Reputation: 118635
Not exactly. A signal is sent to and trapped by a process, not objects.
Another approach might be to maintain a global list of all the objects that must be cleaned up, and install a single signal handler that will clean up each object on that list.
Upvotes: 1