[IPython-dev] Macros don't work in threaded shells
Ville M. Vainio
Mon Mar 10 16:55:23 CDT 2008
On Mon, Mar 10, 2008 at 10:40 PM, Ville M. Vainio <firstname.lastname@example.org> wrote:
> However, with these alterations, I think the condition variable and
> 'got_lock' is an unnecessary complication... but this code is too
> brittle to play around too much, perhaps.
Though I also figure making it simpler would reduce the danger of
deadlocks and other oddities in the future. All we really need is the
- runsource either
1) executes the code directly (if we are in worker thread, i.e. what I just did)
2) Puts (code, event: threading.Event) tuple in queue, and does
even.wait() before it returns
Runcode runs code and does event.set()
The Queue structure really does all the rest, and I can't see any
variables in MTInteractiveShell that need protecting (through using
Condition instead of Event) from re-entrant use, esp. since runcode
always runs in the same thread. Essentially, the Condition variable
now duplicates functionality now already in Queue (in inferior fashion
- queue is first come, first served, if there were ipython commands
being executed from multiple threads) and makes it harder to
understand (I think the condition variable in general is a bit hard to
grasp, compared to other threading primitives).
Thoughs? Perhaps this is radical enough to be experimented in a
separate bzr branch?
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
More information about the IPython-dev