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

InitializeFinalizerThread.cs « Runtime « System « src « System.Private.CoreLib « src - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2b0e67bc86d1a2cfc1b0eea91eefed678ecf4dc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 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.

using Internal.Runtime.Augments;

namespace System.Runtime
{
    internal static class FinalizerInitRunner
    {
        // Here, we are subscribing to a callback from the runtime.  This callback is made from the finalizer
        // thread before any objects are finalized.  
        [RuntimeExport("InitializeFinalizerThread")]
        public static void DoInitialize()
        {
            // Make sure that the finalizer thread is RoInitialized before any objects are finalized.  If this
            // fails, it will throw an exception and that will go unhandled, triggering a FailFast.
            RuntimeThread.RoInitialize();
        }
    }
}