public UnderMutexCookie(LifetimeDefinition def, LifetimeStatus statusUpperBound) { myDef = def; while (true) { var s = myDef.myState; if (ourStatusSlice[s] > statusUpperBound) { Success = false; return; } if (ourMutexSlice[s]) { continue; } if (Interlocked.CompareExchange(ref def.myState, ourMutexSlice.Updated(s, true), s) == s) { break; } } Success = true; }
public InstanceDelivery(LifetimeStatus lifetime, Type type) { Lifetime = lifetime; Type = type; }