Mutex not actually needed

This commit is contained in:
Shawn Bruce authored and Gina Häußge committed 2021-07-15 17:48:22 +02:00
1 parent 3c5c4ff385
commit e82f4551f3
1 file changed
+2 -5
@@ -166,7 +166,6 @@ class VirtualPrinterPlugin(
CHUNK_SIZE = 16
def __init__(self, *args, **kwargs):
self._mutex = threading.Lock()
self._reader = threading.Thread(
target=self._copy_to_incoming, name="reader"
)
@@ -185,8 +184,7 @@ class VirtualPrinterPlugin(
try:
while True:
with self._mutex:
chunk = self._do_read(self.CHUNK_SIZE)
chunk = self._do_read(self.CHUNK_SIZE)
if len(chunk) == 0:
continue
@@ -221,8 +219,7 @@ class VirtualPrinterPlugin(
line += "\n"
try:
with self._mutex:
self._do_write(to_bytes(line, encoding="ascii", errors="replace"))
self._do_write(to_bytes(line, encoding="ascii", errors="replace"))
print(f">>> {line.rstrip()}")
except Exception:
self.close()