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: cc52fda24c538358cfbf7ec2735c2c7d0ff3d4ec (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 CoInitialized before any objects are finalized.  If this
            // fails, it will throw an exception and that will go unhandled, triggering a FailFast.
            RuntimeThread.InitializeCom();
        }
    }
}