SGCluster.java
class SGCluster$C3P2 {
// STATE SPACE VARIABLES:
private static int C3_in , P2_out ;
// LOCAL VARIABLES:
private static Object clusterCounterLock = new Object();
/**======================================================**
**
** Generated lock and methods for atomic: C3$enter
**
**======================================================**/
public static void C3$enter() {
synchronized (clusterCounterLock) {
C3_in ++ ;
}
synchronized (condition$P2$exit) {
condition$P2$exit.notifyAll();
}
}
/**======================================================**
**
** Generated lock and methods for atomic: C3$exit
**
**======================================================**/
public static void C3$exit() {
synchronized (clusterCounterLock) {
}
}
/**======================================================**
**
** Generated lock and methods for atomic: P2$enter
**
**======================================================**/
public static void P2$enter() {
synchronized (clusterCounterLock) {
}
}
/**======================================================**
**
** Generated lock and methods for await: P2$exit
**
**======================================================**/
private static Object condition$P2$exit = new Object();
public static void P2$exit(){
synchronized (condition$P2$exit) {
while ( !check$P2$exit())
try {
condition$P2$exit.wait();
} catch (InterruptedException e){}
}
}
private static boolean check$P2$exit() {
synchronized (clusterCounterLock) {
if (P2_out + 1 <= C3_in * 10 ) {
P2_out ++ ;
return true;
} else
return false;
}
}
}
syntax highlighted by Code2HTML, v. 0.9

