Hi All,
I saw some code where a sem_init
was called with a value of 0.
I didn't quite understand what this meant. I understand that semaphores can be used to protect shared data, in that we allow just one thread to access the data. And, the way to do it is using sem_init
with value 1.
Can anyone please explain what a 0 init(ed) semphore means?
Any explanation would be helpful.
Thanks!