Aahz wrote:

> In article <[EMAIL PROTECTED]>,
> Frans Englich  <[EMAIL PROTECTED]> wrote:
>>
>>Personally I need a solution which touches this discussion. I need to run
>>multiple processes, which I communicate with via stdin/out,
>>simultaneously, and my plan was to do this with threads. Any favorite
>>document pointers, common traps, or something else which could be good to
>>know?
> 
> Threads and forks tend to be problematic.  This is one case I'd recommend
> against threads.

Multiple threads interacting with stdin/stdout?  I've done it with 2 queues. 
One for feeding the threads input and one for them to use for output.  In
fact, using queues takes care of the serialization problems generally
associated with many threads trying to access a single resource (e.g.
stdout).  Python Queues are thread-safe so you don't have to worry about
such issues.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to