Monthly Archives: May 2017

Monitors in concurrent computing – 2 of 3

Monitor usage:

acquire(m); // Acquire this monitor's lock.
while (!p) { // While the condition/predicate/assertion that we are waiting for is not true...
wait(m, cv); // Wait on this monitor's lock and condition variable.
}

// ... Critical section of code goes here ...

signal(cv2); //-- OR -- notifyAll(cv2); cv2 might be the same as cv or different.
release(m); // Release this monitor's lock.

Continue reading: Monitors in concurrent computing – 2 of 3 ▶▶