toland/patron — pull request #48 by TwP (2011-11-15 23:36:00+00:00)
Title: Interrupt active requests when exiting the interpreter

This patch will interrupt any active requests when the Ruby interpreter starts its shutdown sequence. An "at_exit" hook is registered with the interpreter, and this hook signals any active requests that they should stop processing and return immediately.

The curl progress function is used to periodically check the state of an interrupt flag. When it is set, the active request terminates.

I did not include this functionality, but an "interrupt" method could be defined on the Patron::Session that will interrupt an active request. Not sure how useful that would be, though.

This path will close https://github.com/toland/patron/issues/14