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

