Example #1
0
func NewC() *ImpC {
	//
	x := new(ImpC)
	x.m = make(chan int, 1)
	x.m <- 0
	x.okL, x.okR = cond.New(&x.m), cond.New(&x.m)
	return x
}
Example #2
0
func NewC(n uint) *ImpC {
	//
	if n < 2 {
		return nil
	}
	x := new(ImpC)
	x.involved = n
	x.m = make(chan int, 1)
	x.m <- 0
	x.Imp = cond.New(&x.m)
	return x
}
Example #3
0
func NewLockC() *LockC {
	//
	x := new(LockC)
	x.nForks = make([]uint, nPhilos)
	x.m = make(chan int, 1)
	x.m <- 0
	x.c = make([]cond.Condition, nPhilos)
	for p := uint(0); p < nPhilos; p++ {
		x.nForks[p] = 2
		x.c[p] = cond.New(&x.m)
	}
	return x
}