A beginner's question on thread

Timothy Wu huggiepython at graffiti.idv.tw
Thu Apr 8 06:31:04 EDT 2004


Donn Cave wrote:
> Well, that's the deal.  Use threads to solve a problem, and now
> you have two problems.  
> 
> I'd probably do it the way Aurelio Martin proposed, with I/O to
> the socket thread.  It's much neater than whacking the thread,
> which is the alternative.
> 
> I wouldn't necessarily use threads in the first place, though.
> I think it really depends on the user interface - usually that
> has to be the dispatch core of the application, and if it's
> built for threads, then there you go.  Typically there will be
> some provision for dispatch on an I/O channel like a socket.
> If you're writing your own user interface, probably just reading
> and writing to the tty, and the socket thread is going to be
> the one and lonely extra thread - then don't do it, I'd say.
> Use select.select, or a package like asyncore or twisted or
> whatever (not very familiar with that territory, I just use select.)

I think Roger Binns's setDaemon() suggestion works for me. =)
Thanks for suggestion the other options. I'll take a look at asnycore or 
twisted when I have time or perhaps for other projects. Since from what 
I read somewhere else, it doesn't seem like Python thread's performance 
is exceptional.

Timothy




More information about the Python-list mailing list