Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After reading about OpenMP and not finding functions to support semaphores, I did an internet search for OpenMP and the readers and writers problem, but found no suitable matches.

Is there a general method for replacing counting semaphores in OpenMP with something that it supports? Or is there just a gap in the environment where it does not permit things that are asymmetrical like the third readers and writers problem shown on the following page?

share|improve this question
up vote 3 down vote accepted

I found your question while looking for an answer myself. That being said, I found the following link:

They have a section explaining how to use locks which seems very similar to mutex/semaphore.

Another tool for doing similar things is the critical sections directive even though I don't think it can be used for the reader writer problem because I think it will cause race condition.

Hope this was helpfull :D

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.