From 8317e7c7b7d0150dfe35322a56601f2b7b6854d7 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 20 Nov 2021 18:48:58 -0800 Subject: [PATCH] Add some docstrings. --- voussoirkit/threadpool.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/voussoirkit/threadpool.py b/voussoirkit/threadpool.py index 3920bf6..6f32520 100644 --- a/voussoirkit/threadpool.py +++ b/voussoirkit/threadpool.py @@ -60,10 +60,14 @@ class PoolClosed(ThreadPoolException): pass class PooledThread: + ''' + The PooledThreads are created when the pool is created, and live as long as + the pool does. Each PooledThread will continuously fetch jobs from the pool + and work on them. + ''' def __init__(self, pool): self.pool = pool - self.thread = threading.Thread(target=self.start) - self.thread.daemon = True + self.thread = threading.Thread(target=self.start, daemon=True) self.thread.start() def __repr__(self): @@ -250,6 +254,10 @@ class ThreadPool: return these_jobs def get_next_job(self): + ''' + Return the next available Job object, or NO_MORE_JOBS if the pending + queue is empty. This function does not block like a Queue.get would. + ''' with self._job_manager_lock: try: job = next(self._pending_jobs)