##// 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,7 +255,8 b' class HistoryManager(object):'
255
255
256 class HistorySaveThread(threading.Thread):
256 class HistorySaveThread(threading.Thread):
257 """Thread to save history periodically"""
257 """Thread to save history periodically"""
258
258 daemon = True
259
259 def __init__(self, IPython_object, time_interval, exit_now):
260 def __init__(self, IPython_object, time_interval, exit_now):
260 threading.Thread.__init__(self)
261 threading.Thread.__init__(self)
261 self.IPython_object = IPython_object
262 self.IPython_object = IPython_object
@@ -273,6 +274,12 b' class HistorySaveThread(threading.Thread):'
273 #printing for debug
274 #printing for debug
274 #print("Saving...")
275 #print("Saving...")
275 self.IPython_object.save_history()
276 self.IPython_object.save_history()
277
278 def stop(self):
279 self.exit_now=True
280 self.cond.acquire()
281 self.cond.notify()
282 self.cond.release()
276
283
277 def magic_history(self, parameter_s = ''):
284 def magic_history(self, parameter_s = ''):
278 """Print input history (_i<n> variables), with most recent last.
285 """Print input history (_i<n> variables), with most recent last.
@@ -499,10 +499,6 b' class TerminalInteractiveShell(InteractiveShell):'
499 This method calls the ask_exit callback."""
499 This method calls the ask_exit callback."""
500 if self.confirm_exit:
500 if self.confirm_exit:
501 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
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 self.ask_exit()
502 self.ask_exit()
507 else:
503 else:
508 self.ask_exit()
504 self.ask_exit()
General Comments 0
You need to be logged in to leave comments. Login now