任务系统使用 AtomicSafetyHandle 提供验证和全面的安全性。
要使用它,请定义 ENABLE_UNITY_COLLECTIONS_CHECKS 符号。
另请参阅:NativeContainerAttribute 中的示例。
CheckDeallocateAndThrow | 检查是否可以取消分配句柄。如果句柄已销毁或当前有任务正在访问数据,则抛出异常。 |
CheckExistsAndThrow | 检查句柄是否仍然有效,如果句柄已销毁,则抛出异常。 |
CheckGetSecondaryDataPointerAndThrow | CheckGetSecondaryDataPointerAndThrow。 |
CheckReadAndThrow | 检查是否可以读取句柄。如果句柄已销毁或当前有任务正在写入数据,则抛出异常。 |
CheckWriteAndBumpSecondaryVersion | 执行 CheckWriteAndThrow,然后切换辅助版本。 |
CheckWriteAndThrow | 检查是否可以写入句柄。如果句柄已销毁或当前有任务正在读取或写入数据,则抛出异常。 |
Create | 创建一个新的 AtomicSafetyHandle,其有效期至调用 AtomicSafetyHandle.Release 为止。 |
EnforceAllBufferJobsHaveCompleted | 等待针对该 AtomicSafetyHandle 运行的所有任务完成。 |
EnforceAllBufferJobsHaveCompletedAndDisableReadWrite | 等待针对该 AtomicSafetyHandle 运行的所有任务完成,然后禁用对该原子安全句柄的读写访问。 |
EnforceAllBufferJobsHaveCompletedAndRelease | 等待针对该 AtomicSafetyHandle 运行的所有任务完成,然后释放该原子安全句柄。 |
GetAllowReadOrWriteAccess | 如果 AtomicSafetyHandle 配置为允许读取或写入,则返回 true。 |
GetReaderArray | 获取读取该安全句柄的所有任务的任务句柄。 |
GetReaderName | 返回指定读取任务的名称。 |
GetTempMemoryHandle | 返回应该用于此临时内存范围中所有临时内存分配的安全句柄。所有临时内存分配共享相同的安全句柄,因为会同时自动处置它们。 |
GetTempUnsafePtrSliceHandle | 返回单个共享句柄,可以由指向堆栈内存的 NativeSlice 等共享。 |
GetWriter | 返回某个原子安全句柄的写入器(如果有的话)。 |
GetWriterName | 返回某个原子安全句柄的当前写入器的调试名称。 |
IsTempMemoryHandle | 检查 AtomicSafetyHandle 是否是当前活动临时内存范围的临时内存安全句柄。 |
PrepareUndisposable | 标记 AtomicSafetyHandle,使其无法被处置。 |
Release | 释放以前创建的 AtomicSafetyHandle。 |
SetAllowReadOrWriteAccess | 允许您阻止对该原子安全句柄的读取或写入访问。 |
SetAllowSecondaryVersionWriting | 将该 AtomicSafetyHandle 切换为辅助版本号。 |
UseSecondaryVersion | 将该 AtomicSafetyHandle 切换为辅助版本号。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.