Understanding Semaphores

I am trying to model the Bounded-Buffer Problem. My code essentially creates two threads; one reads data from a file into an array and another reads data from the same array into another file. For synchronization purposes, I need to employ semaphores so that "reading" happens only after "writing" has occurred. But I don't have much understanding of semaphores. Am I supposed to write a class that determines how semaphores would behave in my program? Some input and helpful links with examples with definitely help.
See MSDN entry for CreateSemaphore, etc

Also see related thread for further info
http://www.cplusplus.com/forum/general/48297/
Topic archived. No new replies allowed.