From dac5fa322e6129158a779cecf5baf3da26ae4c65 Mon Sep 17 00:00:00 2001 From: ketralnis Date: Tue, 28 Jul 2009 15:53:51 -0700 Subject: [PATCH] Allow utils.worker to be joined explicitly --- r2/r2/lib/utils/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/r2/r2/lib/utils/utils.py b/r2/r2/lib/utils/utils.py index 3101763c0..4de11d78f 100644 --- a/r2/r2/lib/utils/utils.py +++ b/r2/r2/lib/utils/utils.py @@ -785,14 +785,17 @@ class Worker: fn = self.q.get() try: fn() + self.q.task_done() except: import traceback print traceback.format_exc() - def do(self, fn): self.q.put(fn) + def join(self): + self.q.join() + worker = Worker() def cols(lst, ncols):