You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@ -0,0 +1,37 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|
||||
//
|
||||
// Padding.cs
|
||||
//
|
||||
//
|
||||
// Helper structs for padding over CPU cache lines to avoid false sharing.
|
||||
//
|
||||
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Threading.Tasks.Dataflow.Internal
|
||||
{
|
||||
/// <summary>A placeholder class for common padding constants and eventually routines.</summary>
|
||||
internal static class Padding
|
||||
{
|
||||
/// <summary>A size greater than or equal to the size of the most common CPU cache lines.</summary>
|
||||
internal const int CACHE_LINE_SIZE = 128;
|
||||
}
|
||||
|
||||
/// <summary>Padding structure used to minimize false sharing in SingleProducerSingleConsumerQueue{T}.</summary>
|
||||
[StructLayout(LayoutKind.Explicit, Size = Padding.CACHE_LINE_SIZE - sizeof(Int32))] // Based on common case of 64-byte cache lines
|
||||
internal struct PaddingForInt32
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Value type that contains single Int64 value padded on both sides.</summary>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 2 * Padding.CACHE_LINE_SIZE)]
|
||||
internal struct PaddedInt64
|
||||
{
|
||||
[FieldOffset(Padding.CACHE_LINE_SIZE)]
|
||||
internal Int64 Value;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user