Added a possibility to define a call back on thread pool die.