Itβs never bad advice to consider something.
To the contrary, consideration takes time, and rules of thumb are valuable to mitigate overthinking.
Re:Coroutines in C
by a1369209993 on Sunday February 25, 2024 @02:24PM
(#39503891)
No, it's frequently bad advice to consider something. See eg https://www.xkcd.com/1445/.
Re:Coroutines in C
by rstuart4133 on Monday February 26, 2024 @04:53PM
(#39517176)
"Consider using threads" is only safe advice if the person doing the considering knows how to dealt with the (usually unwanted) non-determinism threads introduce.
Only a small fraction do, but threads look so simple on the surface the rest don't realise they are walking into a mine field.
Real world and toy examples are very different. The example isn't like what people are using coroutines for in the real world. I'd urge you to look at how coroutines are used for inversion of control (quite correctly) in qemu.
Bad advice in general.
Why would you run separate thread if you only want is to iterate over nodes in a tree (as an example of non flat collection).