PPT Slide
class SharedCounter {
synchronized public int increment()
{
local_counter++;
return local_counter;
}
...
}
Locks the lock for the object (not the method). The object is a monitor and the synchronized methods are entry points.
Previous slide
Next slide
Back to first slide
View graphic version