Show More
@@ -261,14 +261,17 b' class HistorySaveThread(threading.Thread):' | |||
|
261 | 261 | self.IPython_object = IPython_object |
|
262 | 262 | self.time_interval = time_interval |
|
263 | 263 | self.exit_now = exit_now |
|
264 | self.cond = threading.Condition() | |
|
264 | 265 | |
|
265 | 266 | def run(self): |
|
266 | 267 | while 1: |
|
268 | self.cond.acquire() | |
|
269 | self.cond.wait(self.time_interval) | |
|
270 | self.cond.release() | |
|
267 | 271 | if self.exit_now==True: |
|
268 | 272 | break |
|
269 | time.sleep(self.time_interval) | |
|
270 | 273 | #printing for debug |
|
271 |
|
|
|
274 | print("Saving...") | |
|
272 | 275 | self.IPython_object.save_history() |
|
273 | 276 | |
|
274 | 277 | def magic_history(self, parameter_s = ''): |
@@ -294,7 +294,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
294 | 294 | self.init_payload() |
|
295 | 295 | self.hooks.late_startup_hook() |
|
296 | 296 | atexit.register(self.atexit_operations) |
|
297 |
self.history_thread = HistorySaveThread(self, |
|
|
297 | self.history_thread = HistorySaveThread(self, 60, False) | |
|
298 | 298 | self.history_thread.start() |
|
299 | 299 | |
|
300 | 300 | # While we're trying to have each part of the code directly access what it |
@@ -500,9 +500,12 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
500 | 500 | if self.confirm_exit: |
|
501 | 501 | if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'): |
|
502 | 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() | |
|
503 | 506 | self.ask_exit() |
|
504 | 507 | else: |
|
505 |
self.shell.history_thread = HistorySaveThread(self.shell, |
|
|
508 | self.shell.history_thread = HistorySaveThread(self.shell, 60, False) | |
|
506 | 509 | self.shell.history_thread.start() |
|
507 | 510 | self.ask_exit() |
|
508 | 511 |
General Comments 0
You need to be logged in to leave comments.
Login now