I\'m creating a threading.Timer(2,work) run threads. Inside each work function, upon some condition the global counter must increment without conflict for acces
Not sure if you have tried this specific syntax already, but for me this has always worked well:
Define a global lock:
import threading
threadLock = threading.Lock()
and then you have to acquire and release the lock every time you increase your counter in your individual threads:
with threadLock:
global_counter += 1