[TIP] Testing multi-threaded applications
Nicola Larosa
nico at tekNico.net
Wed May 9 11:58:59 PDT 2007
> Bernhard Mulder wrote:
>> Is there some other recommended way to deal with this issue?
Atul Varma wrote:
> This is probably not the answer you're looking for, but generally the
> advice I've seen is to simply not use threads.
That's great advice, in my book, the kind of non-requested one that I
always give. ;-) But...
> For instance, use asynchronous single-threaded alternatives like
> asyncore,
...are you really, with a straight face, mentioning asyncore and *not*
Twisted?!?
> or a solution that involves coroutines and microthreads like
> Stackless/PyPy.
It may also be useful mentioning the reason: preemptive multithreading is
fundamentally out of control. Its huge problems may be mitigated by
avoiding to share any state whatsoever among threads, and using message
passing via Queues for inter-thread communication, but it's better doing
without multithreading altogether, if at all possible.
--
Nicola Larosa - http://www.tekNico.net/
We used to quip that "password" is the most common password. Now it's
"password1." Who said users haven't learned anything about security?
-- Bruce Schneier, December 2006
More information about the testing-in-python
mailing list