how to make a thread-safe global counter in python
<p>I'm creating a <code>threading.Timer(2,work)</code> run threads. Inside each work function, upon some condition the global counter must increment without conflict for access of counter variable among the spawned work threads.</p>

<p>I've tried <code>Queue.Queue</code> assigned counter as well as <code>threading.Lock()</code>. Which is a best way to implement thread-safe global increment variable. </p>

<p>Previously someone asked question here: <a href="https://stackoverflow.com/questions/10525185/python-threading-how-do-i-lock-a-thread">Python threading. How do I lock a thread?</a></p>