Why detach() is Required #338
Unanswered
Aobanana-chan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While experimenting with unconventional implementations of common patterns in smol under specific environmental constraints, I observed unexpected behavior regarding task scheduling.
In my initial test case,
tasks t1 and t2 executed concurrently as anticipated, producing outputs for both "t1" and 100 iterations of "t2". However, when encapsulating the spawning of t2 within t1's execution flow,
t2 consistently failed to schedule. This caused tasks to accumulate in the Executor indefinitely, blocking event loop progression (tick exit) unless explicit detach() was applied to t2.
This discrepancy raises a conceptual question: Why does the nested task architecture mandate detach() for t2's execution, whereas parallel task spawning at the same scheduling level does not? This seems a bit counterintuitive to me.
Beta Was this translation helpful? Give feedback.
All reactions