Cameron Simpson  committed 71ee47c

cs.threads: runTree: coerce functions returning generators to list, forcing execution of the generator in parallel with other tasks instead of constructing a huge single threaded generator tree executed later

  • Participants
  • Parent commits 334e94f
  • Branches default

Comments (0)

Files changed (1)

File lib/python/cs/

   LFs = []
   for input in inputs:
     substate = copy(state) if fork_state else state
-    LF = funcQ.defer(func, input, substate)
+    def submit_func(func, input, substate):
+      return list(func(input, substate))
+    LF = funcQ.defer(submit_func, func, input, substate)
   # now submit a function to collect the results