0

I am trying to implement a monitor in C to use to solve the producer/consumer problem. I understand the producer/consumer problem and I also understand the solution using monitors. However, I am having a hard time translating that to C without using condition variables. I have tried looking everywhere but all the examples use conditional variables.

user3060454
  • 61
  • 1
  • 8
  • 1
    [wikipedia](http://en.wikipedia.org/wiki/Producer–consumer_problem#Using_semaphores) – D.Shawley Oct 14 '14 at 00:50
  • ^Like I said, I completely understand semaphores, producer/consumer, etc. I am just having a really hard time translating everything into C. – user3060454 Oct 14 '14 at 01:00
  • What do you mean by 'monitor'? Is this a bare-metal coding exercise? – Rich Oct 14 '14 at 02:03
  • The monitor is to protect a buffer as in the classical producer/consumer problem. So you have a buffer of size 500. You have producers that are putting random chars into the buffer. You have consumers that are taking out chars. The monitor is used to protect the buffer when multiple producer and consumer processes are running. – user3060454 Oct 14 '14 at 02:42

0 Answers0