예제 #1
0
        public void EndExclusiveTransaction()
        {
            if (!IsInTransaction)
            {
                return;
            }

            m_ExclusiveTransactionDependency.Complete();

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            var res = AtomicSafetyHandle.EnforceAllBufferJobsHaveCompletedAndRelease(ExclusiveTransactionSafety);
            if (res != EnforceJobResult.AllJobsAlreadySynced)
            {
                //@TODO: Better message
                Debug.LogError("ExclusiveEntityTransaction job has not been registered");
            }
#endif
            IsInTransaction = false;

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            for (var i = 0; i != TypeManager.GetTypeCount(); i++)
            {
                m_ComponentSafetyHandles[i].SafetyHandle = AtomicSafetyHandle.Create();
                AtomicSafetyHandle.SetAllowSecondaryVersionWriting(m_ComponentSafetyHandles[i].SafetyHandle, false);
            }
#endif
        }
예제 #2
0
        public void Dispose()
        {
            for (var i = 0; i < kMaxTypes; i++)
            {
                m_ComponentSafetyHandles[i].WriteFence.Complete();
            }

            for (var i = 0; i < kMaxTypes * kMaxReadJobHandles; i++)
            {
                m_ReadJobFences[i].Complete();
            }

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            for (var i = 0; i < kMaxTypes; i++)
            {
                var res = AtomicSafetyHandle.EnforceAllBufferJobsHaveCompletedAndRelease(m_ComponentSafetyHandles[i]
                                                                                         .SafetyHandle);
                if (res == EnforceJobResult.DidSyncRunningJobs)
                {
                    Debug.LogError(
                        "Disposing EntityManager but a job is still running against the ComponentData. It appears the job has not been registered with JobComponentSystem.AddDependency.");
                }
            }

            AtomicSafetyHandle.Release(m_TempSafety);
#endif

            UnsafeUtility.Free(m_JobDependencyCombineBuffer, Allocator.Persistent);

            UnsafeUtility.Free(m_ComponentSafetyHandles, Allocator.Persistent);
            m_ComponentSafetyHandles = null;

            UnsafeUtility.Free(m_ReadJobFences, Allocator.Persistent);
            m_ReadJobFences = null;
        }
예제 #3
0
        public void EndExclusiveTransaction()
        {
            var res = AtomicSafetyHandle.EnforceAllBufferJobsHaveCompletedAndRelease(ExclusiveTransactionSafety);

            if (res != EnforceJobResult.AllJobsAlreadySynced)
            {
                //@TODO: Better message
                Debug.LogError("ExclusiveEntityTransaction job has not been registered");
            }
        }
        public void EndExclusiveTransaction()
        {
            if (!IsInTransaction)
            {
                return;
            }

            m_ExclusiveTransactionDependency.Complete();

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            var res = AtomicSafetyHandle.EnforceAllBufferJobsHaveCompletedAndRelease(ExclusiveTransactionSafety);
            if (res != EnforceJobResult.AllJobsAlreadySynced)
            {
                //@TODO: Better message
                Debug.LogError("ExclusiveEntityTransaction job has not been registered");
            }
#endif
            IsInTransaction = false;
        }
예제 #5
0
        public void Dispose()
        {
            for (var i = 0; i < m_ComponentSafetyHandlesCount; i++)
            {
                var res0 = AtomicSafetyHandle.EnforceAllBufferJobsHaveCompletedAndRelease(m_ComponentSafetyHandles[i].SafetyHandle);
                var res1 = AtomicSafetyHandle.EnforceAllBufferJobsHaveCompletedAndRelease(m_ComponentSafetyHandles[i].BufferHandle);

                if (res0 == EnforceJobResult.DidSyncRunningJobs || res1 == EnforceJobResult.DidSyncRunningJobs)
                {
                    Debug.LogError(
                        "Disposing EntityManager but a job is still running against the ComponentData. It appears the job has not been registered with JobComponentSystem.AddDependency.");
                }
            }

            AtomicSafetyHandle.Release(m_TempSafety);

            UnsafeUtility.Free(m_TypeArrayIndices, Allocator.Persistent);
            UnsafeUtility.Free(m_ComponentSafetyHandles, Allocator.Persistent);
            m_ComponentSafetyHandles = null;
        }