Thanks, this answer clarifies a lot. Unfortunately, since my library is more 
like a framework, with users that probably don't understand the concept of 
signals, etc., we felt the need to handle the cleanup for them, especially when 
it comes to closing handshakes and the like.

Since this is an internal project, I believe we can guide our users to not 
handle signals by themselves. I'm not too fond of global variables as well, but 
as long as it's just my library handling them, then I can deal with it.

Thanks.

Just to summarize here:

It is not possible to use closures, thus not possible to access the environment 
outside of global variables. And since there can be only one handler (per 
signal or per process?), it is not possible to "add" a proc to run as a signal 
comes. It will always overwrite the previous handler (if any).

Reply via email to