Skip to content

Commit

Permalink
Use Deque for thread pool
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Collins committed Sep 9, 2020
1 parent ccf6f86 commit ccc07ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/labthings/actions/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
import threading
from functools import wraps

from ..deque import Deque
from .thread import ActionThread


# TODO: Handle discarding old actions. Action views now use deques
class Pool:
""" """

def __init__(self):
self.threads = set()
def __init__(self, maxlen: int = 100):
self.threads = Deque(maxlen=maxlen)

def add(self, thread: ActionThread):
"""
:param thread: ActionThread:
"""
self.threads.add(thread)
self.threads.append(thread)

def start(self, thread: ActionThread):
"""
Expand Down

0 comments on commit ccc07ab

Please sign in to comment.