Collections Collections
Collections Collections
DocFX + Singulink = ♥

Search Results for

    Method UnsafePerformLockedOperation

    UnsafePerformLockedOperation<TState>(TState, Action<WeakList<T>, TState>)

    Runs the specified operation while holding the list's internal lock, so that multiple operations can be performed without other threads modifying the list in between them.

    Declaration
    public void UnsafePerformLockedOperation<TState>(TState state, Action<WeakList<T>, TState> operation) where TState : allows ref struct
    Parameters
    Type Name Description
    TState state

    A state value to pass to the operation.

    Action<WeakList<T>, TState> operation

    The operation to run. It receives the list and the state value.

    Type Parameters
    Name Description
    TState
    Remarks

    The lock is also required by the finalizer thread to remove nodes whose values have been garbage collected, so holding it for more than a short time delays finalization of every object in the process. Keep operations short. For long-running compound operations, use your own lock and account for nodes being removed from the list concurrently.

    Disposing the list from within operation releases the lock immediately, so any code that runs in the operation after the dispose call is no longer protected by it.

    Exceptions
    Type Condition
    ObjectDisposedException

    The list has been disposed.

    © Singulink. All rights reserved.