docs.unity3d.com
    Show / Hide Table of Contents

    Struct DispatchQueue

    Double buffered thread-safe queue that is used by com.unity.logging. One buffer is used for write: several threads can add new LogMessage's to it Second one is used as read-only buffer: sinks and logging system's cleanup system read it. Cleanup system calls EndReadClearAndFlip() at the end of its work, cleaning read-only buffer and flipping write/read-only ones.

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

    Constructors

    DispatchQueue(Int32)

    Constructor for DispatchQueue. Will create two lists with size = , max amount of LogMessage's that it can process before it should be flipped

    Declaration
    public DispatchQueue(int size)
    Parameters
    Type Name Description
    Int32 size

    Max length of the queue

    Properties

    IsCreated

    Is true if this struct was initialized.

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

    TotalLength

    Total length of read-only and write buffers. Usually used for testing of internal state of the queue.

    Declaration
    public readonly int TotalLength { get; }
    Property Value
    Type Description
    Int32

    Methods

    BeginRead()

    Puts DispatchQueue into reading lock mode till EndRead or EndReadClearAndFlip is called to prevent buffer flipping.

    Declaration
    public UnsafeList<LogMessage>.ParallelReader BeginRead()
    Returns
    Type Description
    UnsafeList.ParallelReader<>

    ParallelReader is returned that can be used to get all the LogMessage's from read-only buffer

    Dispose()

    Dispose call that will call Dispose for the lists (under lock) if IsCreated is true. IDisposable

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

    EndRead()

    Unlocks DispatchQueue reading lock that was initiated by BeginRead()

    Declaration
    public void EndRead()

    EndReadClearAndFlip()

    Clears read-only buffer and swaps it with write buffer. Then unlocks DispatchQueue reading lock that was initiated by BeginRead()

    Declaration
    public void EndReadClearAndFlip()

    Enqueue(ref LogMessage)

    Declaration
    public void Enqueue(ref LogMessage message)
    Parameters
    Type Name Description
    LogMessage message
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023