Simple process synchronization question
I have a relatively simple question about the best way to do process synchronization in C. I'm writing a multi-process application where I spawn multiple processes at the beginning using fork.
Each of these processes then goes into a while loop until some criteria is met. I now want to synchronize those processes so that they start each loop iteration at about the same time. I basically want something like a barrier that has to be reached before starting a loop iteration.
What is the easiest way to do that in C? I though about using semaphores, but not sure if this is the best solution.