I have the following function that I use as an entry point for a windows fiber.
void foo(void*) {
for(int i =0; i < 10; ++i) { doStuff(); }
}
Now I call SwitchToFiber
in my main in a for loop; something like the following.
int main() {
... create the fiber and stuff
for (int i = 0; i < 50; ++i) {
SwitchToFiber(foo_fiber_ptr);
// how do I tell if foo has already finished execution?
// (without passing in a state variable to communicate.)
if (someCondition) { break; }
}
... do stuff
}
So my question is: how do I tell if foo has already finished execution?(without passing in a state variable or declaring a global state variable to communicate.)