multi threads modify a global list in python
问题 i want to add an item into a global list every 2 seconds in one thread, and save the list into database before empty it every 3 seconds in another thread. i create two local varibles to monitor the total added items and total saveditems, they should be equal every 6 senconds,but it is not. here is my code: import datetime import psutil,os,time from threading import * class AddToList(Thread): totalAdded=0 def run(self): lock=RLock() lock.acquire() while True: entryList.append("AddToList at "