mirror of
https://github.com/craigerl/aprsd.git
synced 2025-09-02 13:17:54 -04:00
Added pause_all, unpause_all in threadlist
This patch adds methods for pausing and unpausing all threads in the APRSDThreadList.
This commit is contained in:
parent
505565d3a6
commit
76d275db9c
@ -40,6 +40,7 @@ class APRSDThread(threading.Thread, metaclass=abc.ABCMeta):
|
||||
self._pause = False
|
||||
|
||||
def stop(self):
|
||||
LOG.debug(f"Stopping thread '{self.name}'")
|
||||
self.thread_stop = True
|
||||
|
||||
@abc.abstractmethod
|
||||
@ -119,6 +120,24 @@ class APRSDThreadList:
|
||||
LOG.info(F"{th.name} packet {th.packet}")
|
||||
th.stop()
|
||||
|
||||
@wrapt.synchronized
|
||||
def pause_all(self):
|
||||
"""Iterate over all threads and pause them."""
|
||||
for th in self.threads_list:
|
||||
LOG.info(f"Pausing Thread {th.name}")
|
||||
if hasattr(th, "packet"):
|
||||
LOG.info(F"{th.name} packet {th.packet}")
|
||||
th.pause()
|
||||
|
||||
@wrapt.synchronized
|
||||
def unpause_all(self):
|
||||
"""Iterate over all threads and resume them."""
|
||||
for th in self.threads_list:
|
||||
LOG.info(f"Resuming Thread {th.name}")
|
||||
if hasattr(th, "packet"):
|
||||
LOG.info(F"{th.name} packet {th.packet}")
|
||||
th.unpause()
|
||||
|
||||
@wrapt.synchronized(lock)
|
||||
def info(self):
|
||||
"""Go through all the threads and collect info about each."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user