Version: 2023.2

AtomicSafetyHandle

struct in Unity.Collections.LowLevel.Unsafe

切换到手册

描述

AtomicSafetyHandle is used by the job system to coordinate access to container memory from multiple jobs safely.

You typically do not need to use this type in your code unless you are implementing your own NativeContainer type. For a conceptual overview of AtomicSafetyHandle and the role it plays in the job system, see Implement a custom native container.

静态函数

CheckDeallocateAndThrow检查是否可以取消分配句柄。如果句柄已销毁或当前有任务正在访问数据,则抛出异常。
CheckExistsAndThrow检查句柄是否仍然有效,如果句柄已销毁,则抛出异常。
CheckGetSecondaryDataPointerAndThrowCheck if the data pointer is in a valid state to be aliased by a view on the container which will use the secondary version number.
CheckReadAndThrow检查是否可以读取句柄。如果句柄已销毁或当前有任务正在写入数据,则抛出异常。
CheckWriteAndBumpSecondaryVersionPerforms AtomicSafetyHandle.CheckWriteAndThrow and then, assuming that the handle can be written to, bumps the secondary version.
CheckWriteAndThrow检查是否可以写入句柄。如果句柄已销毁或当前有任务正在读取或写入数据,则抛出异常。
CreateCreates a new AtomicSafetyHandle.
EnforceAllBufferJobsHaveCompleted等待针对该 AtomicSafetyHandle 运行的所有任务完成。
EnforceAllBufferJobsHaveCompletedAndDisableReadWrite等待针对该 AtomicSafetyHandle 运行的所有任务完成,然后禁用对该原子安全句柄的读写访问。
EnforceAllBufferJobsHaveCompletedAndRelease等待针对该 AtomicSafetyHandle 运行的所有任务完成,然后释放该原子安全句柄。
GetAllowReadOrWriteAccess如果 AtomicSafetyHandle 配置为允许读取或写入,则返回 true。
GetNestedContainerCheck whether the given AtomicSafetyHandle represents a nested container, and therefore cannot safely be used in jobs.
GetReaderArray获取读取该安全句柄的所有任务的任务句柄。
GetReaderName返回指定读取任务的名称。
GetTempMemoryHandleReturns the safety handle which should be used for all temp memory allocations in this temp memory scope.
GetTempUnsafePtrSliceHandle返回单个共享句柄,可以由指向堆栈内存的 NativeSlice 等共享。
GetWriter返回某个原子安全句柄的写入器(如果有的话)。
GetWriterName返回某个原子安全句柄的当前写入器的调试名称。
IsDefaultValueCheck if the handle still has its default value (i.e. has not yet been initialized by being assigned or passed to AtomicSafetyHandle.Create).
IsHandleValidCheck if the AtomicSafetyHandle is still valid.
IsTempMemoryHandle检查 AtomicSafetyHandle 是否是当前活动临时内存范围的临时内存安全句柄。
IsValidNonDefaultHandleCheck if the handle has been initialized and is currently valid.
NewStaticSafetyIdAllocates a new static safety ID, to store information for the provided type T.
PrepareUndisposable标记 AtomicSafetyHandle,使其无法被处置。
Release释放以前创建的 AtomicSafetyHandle。
SetAllowReadOrWriteAccess允许您阻止对该原子安全句柄的读取或写入访问。
SetAllowSecondaryVersionWritingSet whether handles which use the secondary version number are allowed to write to the container protected by this handle.
SetBumpSecondaryVersionOnScheduleWriteLets you automatically bump the secondary version when scheduling a job that has write access to the atomic safety handle.
SetCustomErrorMessageProvide a custom error message for a specific job debugger error type, in cases where additional context can be provided.
SetNestedContainerSets or unsets the nested container flag on an AtomicSafetyHandle.
SetStaticSafetyIdAssigns the provided static safety ID to an AtomicSafetyHandle. The ID's owner type name and any custom error messages are used by the job debugger when reporting errors involving the target handle.
UseSecondaryVersion将该 AtomicSafetyHandle 切换为辅助版本号。
ValidateNonDefaultHandleCheck that the handle has been initialized, and if so, check that it is still valid.