diff --git a/offlineimap/folder/LocalStatus.py b/offlineimap/folder/LocalStatus.py index b3779fd..6f65f83 100644 --- a/offlineimap/folder/LocalStatus.py +++ b/offlineimap/folder/LocalStatus.py @@ -85,8 +85,7 @@ class LocalStatusFolder(BaseFolder): file.close() def save(self): - self.savelock.acquire() - try: + with self.savelock: file = open(self.filename + ".tmp", "wt") file.write(magicline + "\n") for msg in self.messagelist.values(): @@ -104,9 +103,6 @@ class LocalStatusFolder(BaseFolder): os.fsync(fd) os.close(fd) - finally: - self.savelock.release() - def getmessagelist(self): return self.messagelist