Let there be a one-threaded programm, which calls a large functionLarge()
, which needs to finish before the next codeline in the callers main
Function. Assume the function is well broken down and just takes long.
In this answer .wait()
is suggested and I wonder if its better than:
bool done = false;
// returning true at the end, modifies bigObject by refrence
done = functionLarge(bigObject);
while(!done) { usleep(1000); }
//...can now continue
Are there better approaches, without the returning bool
?