[EMAIL PROTECTED] wrote:
Hello,

I have multi thread program running together and each will increment
int i.

How can we make only one thread at a time be able to access and
increment i ?

Thanks in advance,

Sincerely Yours,
pujo


Use a synchronization primitive such as a lock (threading.Lock, threading.RLock)

But for simply incrementing a number (i+=1) this is not needed
because that operation cannot be interrupted by another thread,
as far as I know.

--Irmen

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to