+ 1
Steps in thread step by step with dependent result
Hi It is a task to implement the algorithm in 5 steps. These steps are logical for sure. It must be implemented in five different threads and one result is dependent on other results. I tried implementation as below:. Is this correct? What's the use of implementation of threads if result of one is dependent on other? Or am I the one who did not get the implementation/question right . https://sololearn.com/compiler-playground/cN6p7uM3wUDI/?ref=app
8 Antworten
+ 2
you can do it with 1 function
https://sololearn.com/compiler-playground/c7fcnfak1YXr/?ref=app
+ 2
or you can nest the async functions
https://sololearn.com/compiler-playground/csPpoZNu18tZ/?ref=app
+ 2
Thanks Bob_Li this is much cleaner code.
What I am confused about is the need of this implementation . What benefit we will have when all threads can't start until we have result from previous one
It is not a sequential execution? If so, why it was asked as thread question. It's overhead (to use thread) when execution is not parallel.
Is this correct or we missed something from question?
+ 2
maybe think of it as just a proficiency exercise. Not everything we practice on are going to be things we use on actual useful codes...
+ 1
Thanks
0
Yes ofcourse
0
Hi
0
hmm