diff options
| author | Mattias Andrée <maandree@operamail.com> | 2014-03-07 03:29:50 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2014-03-07 03:29:50 +0100 |
| commit | 759c398edbe89c187d41fa1183f2efc44078f391 (patch) | |
| tree | 817db537a316d084b837e9deebf53b79ea6973a0 /src | |
| parent | add test (diff) | |
| download | join-python-759c398edbe89c187d41fa1183f2efc44078f391.tar.gz join-python-759c398edbe89c187d41fa1183f2efc44078f391.tar.bz2 join-python-759c398edbe89c187d41fa1183f2efc44078f391.tar.xz | |
join can join many functions
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
| -rwxr-xr-x | src/test.py | 14 |
1 files changed, 8 insertions, 6 deletions
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: |
