/offlineimap/head: changeset 313
Just to be sure, since it could be called by multiple threads, genmbnames will not lock itself.
This commit is contained in:
parent
f652bc5bac
commit
510fa037d8
@ -18,10 +18,12 @@
|
||||
|
||||
import os.path
|
||||
import re # for folderfilter
|
||||
from threading import *
|
||||
|
||||
boxes = {}
|
||||
config = None
|
||||
accounts = None
|
||||
mblock = Lock()
|
||||
|
||||
def init(conf, accts):
|
||||
global config, accounts
|
||||
@ -45,6 +47,8 @@ def write():
|
||||
def genmbnames():
|
||||
"""Takes a configparser object and a boxlist, which is a list of hashes
|
||||
containing 'accountname' and 'foldername' keys."""
|
||||
mblock.acquire()
|
||||
try:
|
||||
localeval = config.getlocaleval()
|
||||
if not config.getboolean("mbnames", "enabled"):
|
||||
return
|
||||
@ -64,6 +68,7 @@ def genmbnames():
|
||||
file.write(localeval.eval(config.get("mbnames", "sep")).join(itemlist))
|
||||
file.write(localeval.eval(config.get("mbnames", "footer")))
|
||||
file.close()
|
||||
|
||||
finally:
|
||||
mblock.release()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user