Provide an optional callback to client code on thread exits.  Use this to fix a resource leak in Java bindings.