I'm sorry if this question is too easy to solve.
I would like to implement the following scenarios in C++.
There exists a collection of functions to be evaluated like f_1
, f_2
, etc.
While evaluating f_i
, the program is sending and receiving something to or from another host.
When f_i
finishes, there is some return value.
So the program should immediately move to socket part to send the value or receive something from another machine.
But at the same time, computation of f_j
which is not evaluated now should start.
I know multi-threading may solve this problem. But, how a one thread knows if a computation in some specific thread finishes?
If the socket is replaced by File I/O, I think we can do same thing.
It would be really appreciate if you suggest me a way to solve this or some reference to do that.