Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    ConcurrentPool<T> Class

    Namespace: Stride.Core.Threading
    Assembly: Stride.Core.dll

    A concurrent object pool.

    System.Object → ConcurrentPool<T>
    Derived from ConcurrentPool<T>:

    public class ConcurrentPool<T>
        where T : class
    Type Parameters
    Name Description
    T

    The pooled item type

    Remarks

    Circular buffer segments are used as storage. When full, new segments are added as tail. Items are only appended to the tail segment. When the head segment is empty, it will be discarded. After stabilizing, only a single segment exists at a time, causing no further segment allocations or locking.

    Name Description
    Constructors
    ConcurrentPool(Func<T>)

    Initializes a new instance of the ConcurrentPool<T> class.

    Methods
    Acquire()

    Draws an item from the pool.

    Release(T)

    Releases an item back to the pool.

    | Improve this Doc View Source

    Constructors


    ConcurrentPool(Func<T>)

    Initializes a new instance of the ConcurrentPool<T> class.

    public ConcurrentPool(Func<T> factory)
    Parameters
    Type Name Description
    System.Func<T> factory

    The factory method for creating new items, should the pool be empty.

    | Improve this Doc View Source

    Methods


    Acquire()

    Draws an item from the pool.

    public T Acquire()
    Returns
    Type Description
    T

    Release(T)

    Releases an item back to the pool.

    public void Release(T item)
    Parameters
    Type Name Description
    T item

    The item to release to the pool.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation