is +=1 thread safe

AlFire spamgrinder.trylater at ggmail.com
Fri May 2 22:59:27 EDT 2008


Duncan Booth wrote:
[...]
> 
> is equivalent to:
> 
>       x = x.__iadd__(1)

thx all for answers and hints ...

> 
> Generating hundreds of threads is, BTW, a very good way to get poor 
> performance on any system. Don't do that. Create a few threads and put the 
> actions for those threads into a Queue. If you want the threads to execute 
> in parallel investigate using sub-processes.


I know that limitation. However I am bridging to existing software which 
is hard to be changed. and on powerful machine I have at hand it works 
quite fast.

> 
> The threading module already has a function to return the number of Thread 
> objects currently alive.

I have threads within threads - so it does not suit me :-(.

-- 
Andy



More information about the Python-list mailing list