##// END OF EJS Templates
Fix hang-upon exit in terminal version, which was due to the history autosave thread not exiting.
Thomas Kluyver -
Show More
@@ -255,6 +255,7 b' class HistoryManager(object):'
255 255
256 256 class HistorySaveThread(threading.Thread):
257 257 """Thread to save history periodically"""
258 daemon = True
258 259
259 260 def __init__(self, IPython_object, time_interval, exit_now):
260 261 threading.Thread.__init__(self)
@@ -274,6 +275,12 b' class HistorySaveThread(threading.Thread):'
274 275 #print("Saving...")
275 276 self.IPython_object.save_history()
276 277
278 def stop(self):
279 self.exit_now=True
280 self.cond.acquire()
281 self.cond.notify()
282 self.cond.release()
283
277 284 def magic_history(self, parameter_s = ''):
278 285 """Print input history (_i<n> variables), with most recent last.
279 286
@@ -499,10 +499,6 b' class TerminalInteractiveShell(InteractiveShell):'
499 499 This method calls the ask_exit callback."""
500 500 if self.confirm_exit:
501 501 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
502 self.shell.history_thread.exit_now=True
503 self.shell.history_thread.cond.acquire()
504 self.shell.history_thread.cond.notify()
505 self.shell.history_thread.cond.release()
506 502 self.ask_exit()
507 503 else:
508 504 self.ask_exit()
General Comments 0
You need to be logged in to leave comments. Login now