Пример #1
0
        public static void CheckWriteAndBumpSecondaryVersion(AtomicSafetyHandle handle)
        {
            UnityEngine.Assertions.Assert.IsTrue(handle.IsValid());
            UnityEngine.Assertions.Assert.IsFalse(handle.IsSecondaryVersion());
#if DEBUG_DUMMY
            UnityEngine.Debug.Log($"xxx CheckWriteAndBumpSecondaryVersion({handle})");
#endif
            if (!handle.ValidateIsAllowedToWriteEarlyOut())
            {
                CheckWriteAndThrowNoEarlyOut(handle);
            }
            handle.BumpSecondaryVersion();
#if DEBUG_DUMMY
            UnityEngine.Debug.Log($"xxx      CheckWriteAndBumpSecondaryVersion() out = {handle}");
#endif
        }
Пример #2
0
        public static void Release(AtomicSafetyHandle handle)
        {
            unsafe
            {
                AtomicSafetyHandleInternal *hInternal = handle.GetInternal();
                if (hInternal != null)
                {
#if DEBUG_DUMMY
                    UnityEngine.Debug.Log($"xxx Release({handle}");
#endif
                    release(hInternal);
                    hInternal->version1 &= ~AtomicSafetyHandleVersionMask.ReadWriteAndDispose;
                    handle.BumpPrimaryVersion();
                    hInternal->version2 &= ~AtomicSafetyHandleVersionMask.ReadWriteAndDispose;
                    handle.BumpSecondaryVersion();
                    hInternal->permissions = 0;
                }
            }
        }