def __init__(self, msg):
self.msg = msg
-class BFuse(threading.Thread):
+class BFuse:
'''bcachefs fuse runner.
This class runs bcachefs in fusemount mode, and waits until the mount has
'''
def __init__(self, dev, mnt):
- threading.Thread.__init__(self)
+ self.thread = None
self.dev = dev
self.mnt = mnt
self.ready = threading.Event()
def mount(self):
print("Starting fuse thread.")
- self.start()
+
+ assert not self.thread
+ self.thread = threading.Thread(target=self.run)
+ self.thread.start()
+
self.ready.wait()
print("Fuse is mounted.")
run("fusermount3", "-zu", self.mnt)
print("Waiting for thread to exit.")
- self.join(timeout)
- if self.isAlive():
+ self.thread.join(timeout)
+ if self.thread.is_alive():
self.proc.kill()
- self.join()
+ self.thread.join()
+
+ self.thread = None
+ self.ready.clear()
if self.vout:
check_valgrind(self.vout)