docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct SpinLockExclusive

    Burst-friendly synchronization primitive

    Implements
    IDisposable
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Logging
    Assembly: Unity.Logging.dll
    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 bool Locked { get; }
    Property Value
    Type Description
    bool

    Methods

    Dispose()

    Dispose this spin lock. IDisposable

    Declaration
    public void Dispose()

    Lock()

    Lock. Will block if cannot lock immediately

    Declaration
    public void Lock()

    TryLock(ref bool)

    Try to lock. Won't block

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

    Will be true if lock was taken

    Unlock()

    Unlock the spin lock

    Declaration
    public void Unlock()

    Implements

    IDisposable
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)