I am trying to re-write the classic producer-consumer algorithm using Windows libraries in C++. The snipped below was copied from a Java sample. Anyone know the equivalent of lock.notify and lock.wait using Windows Libraries such as EnterCriticalSection?
private Object lock = new Object();
public void produce() throws InterruptedException {
int value = 0;
while (true)
{
synchronized (lock)
{
while(list.size() == LIMIT)
{
lock.wait();
}
list.add(value++);
lock.notify();
}
}
thx!