docs.unity.cn
    Show / Hide Table of Contents

    Struct SpinLockExclusive

    Burst-friendly synchronization primitive

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.Logging
    Syntax
    public struct SpinLockExclusive : IDisposable

    Constructors

    SpinLockExclusive(Allocator)

    Constructor for the spin lock

    Declaration
    public SpinLockExclusive(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    allocator to use for internal memory allocation. Usually should be Allocator.Persistent

    Properties

    Locked

    True if locked

    Declaration
    public readonly bool Locked { get; }
    Property Value
    Type Description
    Boolean

    Methods

    Dispose()

    Dispose this spin lock. IDisposable

    Declaration
    public void Dispose()
    Implements
    IDisposable.Dispose()

    Lock()

    Lock. Will block if cannot lock immediately

    Declaration
    public void Lock()

    TryLock(ref Boolean)

    Try to lock. Won't block

    Declaration
    public void TryLock(ref bool lockTaken)
    Parameters
    Type Name Description
    Boolean lockTaken

    Will be true if lock was taken

    Unlock()

    Unlock the spin lock

    Declaration
    public void Unlock()
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Thursday, August 10, 2023