Beispiel #1
0
            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;
            }
Beispiel #2
0
 public InstanceDelivery(LifetimeStatus lifetime, Type type)
 {
     Lifetime = lifetime;
     Type     = type;
 }