[IPython-dev] ctrl+c in gui, event loops, sure i'm missing something...
ellisonbg.net at gmail.com
Thu Feb 12 15:23:07 EST 2009
> - Implement something like ipy_server or ipy_vimserver that uses
> stdin, stdout+stderr for communication.
These don't use stdin/stdout for communication. They use Unix
sockets. Plus, this is an unsafe thing to do (yes our current
versions have this problem). Here is why. These codes run an event
loop in a thread. They then call the ipython0 core from that thread.
If the user does something interactively with IPython, you have two
threads simultaneiously operating on the ipython0 core and the users
namespace. Because the ipython0 core is not thread safe, this is
entirely unsafe from the threading perspective.
> - stdin is the "control channel" that gives commands that get executed
> with ip.runlines. It may read pickles, or whatever.
> - If the command coming from stdin is not "run this block"
> (concretely, "complete" would be one such command), the response will
> be written to stderr. Otherwise,
> stdout and stderr will behave normally (i.e. stderr can contain both
> control channel replies and normal stderr stuff).
I think stdin/stdout should be reserved for the usual meanings. There
are many robust ways of doing IPC over various types of sockets that
should be used instead for control. This is what things like
vim_server do already - we just need to think carefully about how we
can make these things thread safe.
More information about the IPython-dev