-import threading, pickle, inspect
+import threading, pickle, inspect, atexit
from . import db, index, cache
from .db import txnfun
if self.path is None:
self.path = self.getpath()
self.bk = db.environment(self.path, recover=self.recover)
+ atexit.register(self.close)
return self.bk
def close(self):
with self.lk:
if self.bk is not None:
+ atexit.unregister(self.close)
self.bk.close()
self.bk = None