How can I create a semaphore in C? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I create a semaphore in C?

Hi, I have to create a semaphore that let me put in pause a process called “Player” and, after that the father process has finished some operations, it should signal to the player to continue his execution.

6th Jan 2020, 5:05 PM
riccardo
4 Answers
7th Jan 2020, 2:51 PM
John Wells
John Wells - avatar
+ 5
Standard C does not support threads so semaphores are not needed. Given you are using some non standard thread support, you must specify it so we might be able to answer your question.
7th Jan 2020, 1:41 AM
John Wells
John Wells - avatar
+ 1
thanks you very much!
7th Jan 2020, 5:07 PM
riccardo
0
I use unix based system like linux or MacOs, in the header I put #include<sys/sem.h> #include<sys/shm.h>
7th Jan 2020, 1:50 PM
riccardo