From 759c398edbe89c187d41fa1183f2efc44078f391 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 7 Mar 2014 03:29:50 +0100 Subject: join can join many functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/test.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/test.py') diff --git a/src/test.py b/src/test.py index 125d979..2190451 100755 --- a/src/test.py +++ b/src/test.py @@ -44,12 +44,14 @@ class joinable: self.condition.release() -def join(f): - f.condition.acquire() - f.condition.wait() - (jargs, jkwargs) = f.queue.pop(0) - f.condition.release() - return (jargs, jkwargs) +def join(*fs): + rc = [] + for f in fs: + f.condition.acquire() + f.condition.wait() + rc.append(f.queue.pop(0)) + f.condition.release() + return rc[0] if len(fs) == 1 else rc class test: -- cgit v1.2.3-70-g09d2