Use a common lock for the KMLgen and SQL threads to keep them from stepping on each other when reading the SQLite db

This commit is contained in:
Nick Foster
2012-10-09 23:31:02 -07:00
parent d86e568ac2
commit 67b58d7204
4 changed files with 47 additions and 44 deletions
+3 -2
View File
@@ -194,8 +194,9 @@ if __name__ == '__main__':
if options.kml is not None:
#we spawn a thread to run every 30 seconds (or whatever) to generate KML
dbname = 'adsb.db'
sqldb = air_modes.output_sql(my_position, dbname) #input into the db
kmlgen = air_modes.output_kml(options.kml, dbname, my_position) #create a KML generating thread to read from the db
lock = threading.Lock()
sqldb = air_modes.output_sql(my_position, dbname, lock) #input into the db
kmlgen = air_modes.output_kml(options.kml, dbname, my_position, lock) #create a KML generating thread to read from the db
outputs.append(sqldb.output)
if options.sbs1 is True: