aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/test.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/test.py b/src/test.py
index 3bb7da6..f568614 100755
--- a/src/test.py
+++ b/src/test.py
@@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import time
+
+import random
import threading
@@ -91,7 +93,12 @@ def ordered_join(*f_groups):
def unordered_join(*f_groups):
- pass
+ ready = [i for i, fs in enumerate(f_groups) if all([len(f.queue) for f in fs])]
+ if len(ready):
+ i = ready[random.randrange(len(ready))]
+ return (i, join(*(f_groups[i]))
+ else:
+ return ordered_join(*f_groups)
# extra, not a part of join-calculus