Пример #1
0
        public void Release(Uid o, int uid)
        {
            if (uid == 0)
                return;

            lock (Lock)
            {
                RegisteredObjects.Remove(uid);
                FreeUidList.Enqueue(uid);
            }
        }
Пример #2
0
        public int RegisterObject(Uid o)
        {
            lock (Lock)
            {
                int uid = FreeUidList.Count > 0
                              ? FreeUidList.Dequeue()
                              : NextUid++;

                RegisteredObjects.Add(uid, o);

                return uid;
            }
        }
Пример #3
0
        protected void WriteUid(BinaryWriter writer, Uid uid)
        {
            if (uid == null)
            {
                writer.Write(0L);
                return;
            }

            writer.Write(uid.UID);
            writer.Write(UidFactory.GetFamily(uid).GetHashCode());
        }