/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 os.path
|
||||||
import re # for folderfilter
|
import re # for folderfilter
|
||||||
|
from threading import *
|
||||||
|
|
||||||
boxes = {}
|
boxes = {}
|
||||||
config = None
|
config = None
|
||||||
accounts = None
|
accounts = None
|
||||||
|
mblock = Lock()
|
||||||
|
|
||||||
def init(conf, accts):
|
def init(conf, accts):
|
||||||
global config, accounts
|
global config, accounts
|
||||||
@ -45,6 +47,8 @@ def write():
|
|||||||
def genmbnames():
|
def genmbnames():
|
||||||
"""Takes a configparser object and a boxlist, which is a list of hashes
|
"""Takes a configparser object and a boxlist, which is a list of hashes
|
||||||
containing 'accountname' and 'foldername' keys."""
|
containing 'accountname' and 'foldername' keys."""
|
||||||
|
mblock.acquire()
|
||||||
|
try:
|
||||||
localeval = config.getlocaleval()
|
localeval = config.getlocaleval()
|
||||||
if not config.getboolean("mbnames", "enabled"):
|
if not config.getboolean("mbnames", "enabled"):
|
||||||
return
|
return
|
||||||
@ -64,6 +68,7 @@ def genmbnames():
|
|||||||
file.write(localeval.eval(config.get("mbnames", "sep")).join(itemlist))
|
file.write(localeval.eval(config.get("mbnames", "sep")).join(itemlist))
|
||||||
file.write(localeval.eval(config.get("mbnames", "footer")))
|
file.write(localeval.eval(config.get("mbnames", "footer")))
|
||||||
file.close()
|
file.close()
|
||||||
|
finally:
|
||||||
|
mblock.release()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user