![]() |
|
Producer/Consumer problem in C++ [Solved] - Printable Version +- Southperry.net (https://www.southperry.net) +-- Forum: Social (https://www.southperry.net/forumdisplay.php?fid=14) +--- Forum: Rubik's Cube (https://www.southperry.net/forumdisplay.php?fid=58) +--- Thread: Producer/Consumer problem in C++ [Solved] (/showthread.php?tid=39017) |
Producer/Consumer problem in C++ [Solved] - Unauthorized Intruder - 2011-03-10 Producer should be finished before Consumer starts. I have no idea where should I place WaitForSingleObject for both mutex and semaphore. I placed like this and most of the time Consumer starts and finished before Producer even starts. It's either Producer starts first, result is as it should be. Or Consumer starts first, and wrong result. This is a school project. I have to use either Mutex or Semaphore or both. Edit: Never mind. Problem solved. Just change from Semaphore to same mutex. Code: DWORD Sum; |