Adalm1000_Logger/session_manager.py
Vincent Hanewinkel b2406ed037 test
2025-08-14 22:56:00 +02:00

20 lines
502 B
Python

import threading
class SessionManager:
def __init__(self, sess):
self.sess = sess
self._lock = threading.Lock()
self._count = 0
def start(self):
with self._lock:
if self._count == 0:
self.sess.start(0) # kontinuierlich
self._count += 1
def stop(self):
with self._lock:
if self._count > 0:
self._count -= 1
if self._count == 0:
self.sess.end()