Basic HTML version of Foils prepared May 19 99

Foil 28 Splitting Locks - Example

From Elements of Concurrent Programming in Java Tango Group Internal Technology Seminars -- Spring 99. by Lukasz Beca


1 public class EvenBetterShape {
2 protected double x_ = 0.0;
3 protected double width_ = 0.0;
4 protected Object locationLock_ = new Object();
5 protected Object dimensionLock_ = new Object();
6 public double x() {
7 synchronized(locationLock_) {
8 return x_;
9 }
10 }
11 public double width() {
12 synchronized(dimensionLock_) {
13 return width_;
14 }
15 }
16 }

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed May 19 1999