I am using System V semaphores and want to block a process at its start and wait for another process to up the specific semaphore after it has completed its critical section.
I think that sem_op = 0, would be the proper action to do.
So I initialize the semaphore with 1.
Then at process A, that needs to be blocked I am using the sem_op = 0 in order to wait for the semaphore to became 0.
At process B I am using sem_op = -1. (So this makes the semaphore.val = 0).
And the process that should be blocked prints at stdout when the other has succesfully down'ed the semaphore.
What does the wait for zero functionality actually do and how can I properly use it?
Thank you for your time!