Can I have a sem_t (semaphore) object take an a value of more than 1? Since sem_post only increments by 1. Is there a sem_set?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, a sem_t can take on a value of more than 1. You can use
sem_initto initialise your semaphore to an abitrary value. Quoting from this link:I’m not aware of any function that can increment a sem_t by an arbitrary value.