Version: Unity 6 Beta (6000.0)
LanguageEnglish
  • C#

AtomicSafetyHandle

struct in Unity.Collections.LowLevel.Unsafe

/

Implemented in:UnityEngine.CoreModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Coordinate safe access to native container memory inside the job system.

AtomicSafetyHandle holds a reference to the central information that the safety system stores for a given native container. When a job contains a NativeContainer instance, the job system automatically configures the flags in AtomicSafetyHandle to reflect the way that the native container can be used in that job. Each job has a separate AtomicSafetyHandle instance for a given native container.

Use this class when you implement a custom NativeContainer type. Every NativeContainer instance must contain an AtomicSafetyHandle field named m_Safety. For a conceptual overview of AtomicSafetyHandle and the role it plays in the job system, refer to Implement a custom native container.

Static Methods

CheckDeallocateAndThrowCheck if an AtomicSafetyHandle can be deallocated.
CheckExistsAndThrowCheck if an AtomicSafetyHandle is valid.
CheckGetSecondaryDataPointerAndThrowCheck whether it's safe to create a memory-aliasing view to a native container.
CheckReadAndThrowCheck whether the referenced native container can be read from.
CheckWriteAndBumpSecondaryVersionCheck whether the referenced native container can be written to and increment the secondary version number if so.
CheckWriteAndThrowCheck whether the referenced native container can be written to.
CreateCreates a new AtomicSafetyHandle.
EnforceAllBufferJobsHaveCompletedWaits for all jobs running against the AtomicSafetyHandle to complete.
EnforceAllBufferJobsHaveCompletedAndDisableReadWriteWaits for all jobs running against an AtomicSafetyHandle to complete and then disables the read and write access on the AtomicSafetyHandle.
EnforceAllBufferJobsHaveCompletedAndReleaseWaits for all jobs running against an AtomicSafetyHandle to complete and then releases the AtomicSafetyHandle.
GetAllowReadOrWriteAccessChecks if the AtomicSafetyHandle is configured to allow reading or writing.
GetNestedContainerChecks whether an AtomicSafetyHandle represents a nested container.
GetReaderArrayFetches the job handles of all jobs that read from an AtomicSafetyHandle.
GetReaderNameGets the name of a specified job that reads from an AtomicSafetyHandle.
GetTempMemoryHandleGets an AtomicSafetyHandle for the temporary memory allocations in a temporary memory scope.
GetTempUnsafePtrSliceHandleGets a single shared AtomicSafetyHandle.
GetWriterGets any writers on an AtomicSafetyHandle.
GetWriterNameGets the debug name of the current writer on an AtomicSafetyHandle.
IsDefaultValueChecks if an AtomicSafetyHandle has its default value.
IsHandleValidChecks if an AtomicSafetyHandle is valid.
IsTempMemoryHandleChecks if an AtomicSafetyHandle is the temporary memory safety handle for the active temporary memory scope.
IsValidNonDefaultHandleChecks if an AtomicSafetyHandle has been initialized and is valid.
NewStaticSafetyIdAllocates a new static safety ID to store information for the provided type.
PrepareUndisposableMarks an AtomicSafetyHandle so that it can't be disposed of.
ReleaseReleases a previously created AtomicSafetyHandle.
SetAllowReadOrWriteAccessSets the read or write access on an AtomicSafetyHandle.
SetAllowSecondaryVersionWritingSets whether other AtomicSafetyHandles that use a secondary version number can write to the NativeContainer protected by a given AtomicSafetyHandle.
SetBumpSecondaryVersionOnScheduleWriteSets whether to automatically bump the secondary version when scheduling a job that has write access to the AtomicSafetyHandle.
SetCustomErrorMessageProvides a custom error message for a specific job debugger error type, in cases where additional context can be provided.
SetNestedContainerSets the nested container flag on an AtomicSafetyHandle.
SetStaticSafetyIdAssigns a provided static safety ID to an AtomicSafetyHandle.
UseSecondaryVersionSwitches the AtomicSafetyHandle to the secondary version number.
ValidateNonDefaultHandleChecks that the handle has been initialized, and if so, checks that it is still valid.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961