On May 3, 7:44 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > Alexander Schmolck wrote: > > AlFire <[EMAIL PROTECTED]> writes: > > >>> 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 :-(. > > > How about using a scalar numpy array? They are mutable, so I assume that x > > += > > 1 should be atomic. > > No NO NO! The only way to increment a variable in memory is through a > three step process:
Yes, this will be atomic. It's a pretty good idea, in fact. The underlying increment operation is protected by the GIL; it could be three, forty, or a hundred steps and it'd be atomic at the Python level. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list