Welcome to mirror list, hosted at ThFree Co, Russian Federation.

IPinnable.cs « Buffers « System « shared « System.Private.CoreLib « src - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 623e716a053cce2532144d4aab86a614f3e0c2de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace System.Buffers
{
    /// <summary>
    /// Provides a mechanism for pinning and unpinning objects to prevent the GC from moving them.
    /// </summary>
    public interface IPinnable
    {
        /// <summary>
        /// Call this method to indicate that the IPinnable object can not be moved by the garbage collector.
        /// The address of the pinned object can be taken.
        /// <param name="elementIndex">The offset to the element within the memory at which the returned <see cref="MemoryHandle"/> points to.</param>
        /// </summary>
        MemoryHandle Pin(int elementIndex);

        /// <summary>
        /// Call this method to indicate that the IPinnable object no longer needs to be pinned.
        /// The garbage collector is free to move the object now.
        /// </summary>
        void Unpin();
    }
}