Synchronized statements
Example (mutual exclusive lock on the variable values) :
public static void abs(int[] values) {
synchronized(values) {
for (int i=0; i < values.length; i++) {
if (values[i] < 0)
values[i] = -values[i];
}
}
}
Previous slide
Next slide
Back to first slide
View graphic version