resource sync type item = int op get() returns item {call} op put(item) {call} body sync() op try(cap(item)) process manager { cap(item) go item x; while(true) { # in put(x) -> receive try(go); send go(x); ni receive put(x); receive try(go); send go(x); } } proc get() returns x { op take(item) send try(take) receive take(x) } end sync