##// END OF EJS Templates
Fix (hopefully) another threadign bug, reported by Jorgen.
fperez -
Show More
@@ -4,7 +4,7 b''
4 All the matplotlib support code was co-developed with John Hunter,
4 All the matplotlib support code was co-developed with John Hunter,
5 matplotlib's author.
5 matplotlib's author.
6
6
7 $Id: Shell.py 1297 2006-05-13 19:14:48Z fperez $"""
7 $Id: Shell.py 1313 2006-05-19 17:48:41Z fperez $"""
8
8
9 #*****************************************************************************
9 #*****************************************************************************
10 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
10 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
@@ -361,8 +361,11 b' class MTInteractiveShell(InteractiveShell):'
361 code_to_run = self.code_queue.get_nowait()
361 code_to_run = self.code_queue.get_nowait()
362 except Queue.Empty:
362 except Queue.Empty:
363 break
363 break
364 self.thread_ready.notify()
364 if got_lock:
365 InteractiveShell.runcode(self,code_to_run)
365 self.thread_ready.notify()
366 InteractiveShell.runcode(self,code_to_run)
367 else:
368 break
366
369
367 # We're done with thread-protected variables
370 # We're done with thread-protected variables
368 if got_lock:
371 if got_lock:
@@ -370,11 +373,12 b' class MTInteractiveShell(InteractiveShell):'
370 # This MUST return true for gtk threading to work
373 # This MUST return true for gtk threading to work
371 return True
374 return True
372
375
373 def kill (self):
376 def kill(self):
374 """Kill the thread, returning when it has been shut down."""
377 """Kill the thread, returning when it has been shut down."""
375 self.thread_ready.acquire(False)
378 got_lock = self.thread_ready.acquire(False)
376 self._kill = True
379 self._kill = True
377 self.thread_ready.release()
380 if got_lock:
381 self.thread_ready.release()
378
382
379 class MatplotlibShellBase:
383 class MatplotlibShellBase:
380 """Mixin class to provide the necessary modifications to regular IPython
384 """Mixin class to provide the necessary modifications to regular IPython
General Comments 0
You need to be logged in to leave comments. Login now