thread execution order

Elbert Lev elbertlev at hotmail.com
Thu Sep 30 15:22:03 EDT 2004


"Axel Mittendorf" <newsreply at transfertech.de> wrote in message news:<cjh4nb$opt$05$1 at news.t-online.com>...
> "Rembrandt Q Einstein" wrote:
> > I wouldn't do this with threads.  I'd use select() or similar to see if
> > the pipe is writable and if it isn't, buffer internally.
> I thought about something like this too, but since I'm not allowed to
> use some kinda timer to write out the pending data I can't it that way.
> Therefor I wondered to use threads.
> 
> THX, Axel

Alex!

In simular situations I use one writer thread and Queue per
pipe/socket etc. Worker threads put messages into the queue and
continue. Writer thread gets messages from the queue and writes them
into the pipe. If pipe is full writer waits, but workers are
operational. Writer thread is alive as long as the pipe exists. Queue
is used as a buffer.

Good luck.
Lev.



More information about the Python-list mailing list