785 references to Volatile
GenerateDocumentationAndConfigFiles (13)
Interop.FunctionalTests (1)
Metrics (13)
Metrics.Legacy (13)
Microsoft.AspNetCore.ConcurrencyLimiter (2)
Microsoft.AspNetCore.Cryptography.Internal (3)
Microsoft.AspNetCore.DataProtection (15)
Microsoft.AspNetCore.DataProtection.Extensions (1)
Microsoft.AspNetCore.Hosting (4)
Microsoft.AspNetCore.Http.Connections (4)
Microsoft.AspNetCore.Mvc.Core (2)
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (3)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.AspNetCore.Server.IIS (5)
Microsoft.AspNetCore.Server.Kestrel.Core (12)
Internal\Infrastructure\KestrelEventSource.cs (10)
308_connectionsPerSecondCounter ??= new IncrementingPollingCounter("connections-per-second", this, () => Volatile.Read(ref _totalConnections))
314_totalConnectionsCounter ??= new PollingCounter("total-connections", this, () => Volatile.Read(ref _totalConnections))
319_tlsHandshakesPerSecondCounter ??= new IncrementingPollingCounter("tls-handshakes-per-second", this, () => Volatile.Read(ref _totalTlsHandshakes))
325_totalTlsHandshakesCounter ??= new PollingCounter("total-tls-handshakes", this, () => Volatile.Read(ref _totalTlsHandshakes))
330_currentTlsHandshakesCounter ??= new PollingCounter("current-tls-handshakes", this, () => Volatile.Read(ref _currentTlsHandshakes))
335_failedTlsHandshakesCounter ??= new PollingCounter("failed-tls-handshakes", this, () => Volatile.Read(ref _failedTlsHandshakes))
340_currentConnectionsCounter ??= new PollingCounter("current-connections", this, () => Volatile.Read(ref _currentConnections))
345_connectionQueueLengthCounter ??= new PollingCounter("connection-queue-length", this, () => Volatile.Read(ref _connectionQueueLength))
350_httpRequestQueueLengthCounter ??= new PollingCounter("request-queue-length", this, () => Volatile.Read(ref _httpRequestQueueLength))
355_currrentUpgradedHttpRequestsCounter ??= new PollingCounter("current-upgraded-requests", this, () => Volatile.Read(ref _currentUpgradedHttpRequests))
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (4)
Microsoft.AspNetCore.SignalR.Client.Core (4)
Microsoft.AspNetCore.SignalR.Core (2)
Microsoft.CodeAnalysis (19)
Microsoft.CodeAnalysis.Analyzers (13)
Microsoft.CodeAnalysis.AnalyzerUtilities (13)
Microsoft.CodeAnalysis.BannedApiAnalyzers (13)
Microsoft.CodeAnalysis.CodeStyle (15)
Microsoft.CodeAnalysis.Collections.Package (3)
Microsoft.CodeAnalysis.CSharp (41)
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
Microsoft.CodeAnalysis.CSharp.Features (1)
Microsoft.CodeAnalysis.EditorFeatures (2)
Microsoft.CodeAnalysis.Extensions.Package (3)
Microsoft.CodeAnalysis.Features (6)
Microsoft.CodeAnalysis.InteractiveHost (4)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (13)
Microsoft.CodeAnalysis.PublicApiAnalyzers (13)
Microsoft.CodeAnalysis.ResxSourceGenerator (13)
Microsoft.CodeAnalysis.Threading.Package (4)
Microsoft.CodeAnalysis.VisualBasic (20)
Microsoft.CodeAnalysis.Workspaces (21)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (13)
Microsoft.Extensions.AsyncState (1)
Microsoft.Extensions.Caching.Hybrid (27)
Internal\HybridCacheEventSource.cs (22)
55Volatile.Write(ref _totalLocalCacheHit, 0);
56Volatile.Write(ref _totalLocalCacheMiss, 0);
57Volatile.Write(ref _totalDistributedCacheHit, 0);
58Volatile.Write(ref _totalDistributedCacheMiss, 0);
59Volatile.Write(ref _totalUnderlyingDataQuery, 0);
60Volatile.Write(ref _currentUnderlyingDataQuery, 0);
61Volatile.Write(ref _currentDistributedFetch, 0);
62Volatile.Write(ref _totalLocalCacheWrite, 0);
63Volatile.Write(ref _totalDistributedCacheWrite, 0);
64Volatile.Write(ref _totalStampedeJoin, 0);
65Volatile.Write(ref _totalTagInvalidations, 0);
208new PollingCounter("total-local-cache-hits", this, () => Volatile.Read(ref _totalLocalCacheHit)) { DisplayName = "Total Local Cache Hits" },
209new PollingCounter("total-local-cache-misses", this, () => Volatile.Read(ref _totalLocalCacheMiss)) { DisplayName = "Total Local Cache Misses" },
210new PollingCounter("total-distributed-cache-hits", this, () => Volatile.Read(ref _totalDistributedCacheHit)) { DisplayName = "Total Distributed Cache Hits" },
211new PollingCounter("total-distributed-cache-misses", this, () => Volatile.Read(ref _totalDistributedCacheMiss)) { DisplayName = "Total Distributed Cache Misses" },
212new PollingCounter("total-data-query", this, () => Volatile.Read(ref _totalUnderlyingDataQuery)) { DisplayName = "Total Data Queries" },
213new PollingCounter("current-data-query", this, () => Volatile.Read(ref _currentUnderlyingDataQuery)) { DisplayName = "Current Data Queries" },
214new PollingCounter("current-distributed-cache-fetches", this, () => Volatile.Read(ref _currentDistributedFetch)) { DisplayName = "Current Distributed Cache Fetches" },
215new PollingCounter("total-local-cache-writes", this, () => Volatile.Read(ref _totalLocalCacheWrite)) { DisplayName = "Total Local Cache Writes" },
216new PollingCounter("total-distributed-cache-writes", this, () => Volatile.Read(ref _totalDistributedCacheWrite)) { DisplayName = "Total Distributed Cache Writes" },
217new PollingCounter("total-stampede-joins", this, () => Volatile.Read(ref _totalStampedeJoin)) { DisplayName = "Total Stampede Joins" },
218new PollingCounter("total-tag-invalidations", this, () => Volatile.Read(ref _totalTagInvalidations)) { DisplayName = "Total Tag Invalidations" },
Microsoft.Extensions.Caching.Hybrid.Tests (26)
StampedeTests.cs (19)
117Assert.Equal(0, Volatile.Read(ref executeCount));
118Assert.Equal(0, Volatile.Read(ref cancelCount));
121Assert.Equal(1, Volatile.Read(ref executeCount));
122Assert.Equal(0, Volatile.Read(ref cancelCount));
128Assert.Equal(1, Volatile.Read(ref executeCount));
129Assert.Equal(0, Volatile.Read(ref cancelCount));
132Volatile.Write(ref executeCount, 0);
153Assert.Equal(0, Volatile.Read(ref executeCount));
154Assert.Equal(0, Volatile.Read(ref cancelCount));
158Assert.Equal(1, Volatile.Read(ref executeCount));
159Assert.Equal(0, Volatile.Read(ref cancelCount));
165Assert.Equal(1, Volatile.Read(ref executeCount));
166Assert.Equal(0, Volatile.Read(ref cancelCount));
229Assert.Equal(0, Volatile.Read(ref executeCount));
238Assert.Equal(1, Volatile.Read(ref executeCount));
239Assert.Equal(1, Volatile.Read(ref cancelCount));
313Assert.Equal(0, Volatile.Read(ref executeCount));
322Assert.Equal(1, Volatile.Read(ref executeCount));
323Assert.Equal(0, Volatile.Read(ref cancelCount)); // ran to completion
Microsoft.Extensions.Caching.Memory (5)
Microsoft.Extensions.Caching.StackExchangeRedis (2)
Microsoft.Extensions.Http (2)
Microsoft.Extensions.Primitives (1)
Microsoft.ML.Tokenizers (3)
mscorlib (1)
netstandard (1)
Roslyn.Diagnostics.Analyzers (13)
System.Collections.Concurrent (9)
System.Collections.Immutable (16)
System.ComponentModel.TypeConverter (3)
System.Console (27)
System\Console.cs (24)
47return Volatile.Read(ref s_in) ?? EnsureInitialized();
58Volatile.Write(ref s_in, ConsolePal.GetOrCreateReader());
74Encoding? encoding = Volatile.Read(ref s_inputEncoding);
81Volatile.Write(ref s_inputEncoding, ConsolePal.InputEncoding);
97Volatile.Write(ref s_inputEncoding, (Encoding)value.Clone());
102Volatile.Write(ref s_in, null);
111Encoding? encoding = Volatile.Read(ref s_outputEncoding);
118Volatile.Write(ref s_outputEncoding, ConsolePal.OutputEncoding);
143Volatile.Write(ref s_out, null!);
148Volatile.Write(ref s_error, null!);
151Volatile.Write(ref s_outputEncoding, (Encoding)value.Clone());
200return Volatile.Read(ref s_out) ?? EnsureInitialized();
208Volatile.Write(ref s_out, CreateOutputWriter(ConsolePal.OpenStandardOutput()));
220return Volatile.Read(ref s_error) ?? EnsureInitialized();
228Volatile.Write(ref s_error, CreateOutputWriter(ConsolePal.OpenStandardError()));
258StrongBox<bool> redirected = Volatile.Read(ref _isStdInRedirected) ?? EnsureInitialized();
263Volatile.Write(ref _isStdInRedirected, new StrongBox<bool>(ConsolePal.IsInputRedirectedCore()));
273StrongBox<bool> redirected = Volatile.Read(ref _isStdOutRedirected) ?? EnsureInitialized();
278Volatile.Write(ref _isStdOutRedirected, new StrongBox<bool>(ConsolePal.IsOutputRedirectedCore()));
288StrongBox<bool> redirected = Volatile.Read(ref _isStdErrRedirected) ?? EnsureInitialized();
293Volatile.Write(ref _isStdErrRedirected, new StrongBox<bool>(ConsolePal.IsErrorRedirectedCore()));
666Volatile.Write(ref s_in, newIn);
686Volatile.Write(ref s_out, newOut);
703Volatile.Write(ref s_error, newError);
System.Diagnostics.DiagnosticSource (5)
System.Diagnostics.Process (2)
System.Formats.Nrbf (1)
System.IO.Pipes (2)
System.IO.Ports (2)
System.Linq.Expressions (3)
System.Linq.Parallel (1)
System.Net.Http (7)
System.Net.Quic (11)
System.Net.Requests (1)
System.Net.Sockets (11)
System.Net.WebClient (2)
System.Private.CoreLib (181)
src\libraries\System.Private.CoreLib\src\System\Threading\Thread.cs (26)
575public static byte VolatileRead(ref byte address) => Volatile.Read(ref address);
578public static double VolatileRead(ref double address) => Volatile.Read(ref address);
581public static short VolatileRead(ref short address) => Volatile.Read(ref address);
584public static int VolatileRead(ref int address) => Volatile.Read(ref address);
587public static long VolatileRead(ref long address) => Volatile.Read(ref address);
590public static nint VolatileRead(ref nint address) => Volatile.Read(ref address);
594public static object? VolatileRead([NotNullIfNotNull(nameof(address))] ref object? address) => Volatile.Read(ref address);
598public static sbyte VolatileRead(ref sbyte address) => Volatile.Read(ref address);
601public static float VolatileRead(ref float address) => Volatile.Read(ref address);
605public static ushort VolatileRead(ref ushort address) => Volatile.Read(ref address);
609public static uint VolatileRead(ref uint address) => Volatile.Read(ref address);
613public static ulong VolatileRead(ref ulong address) => Volatile.Read(ref address);
617public static nuint VolatileRead(ref nuint address) => Volatile.Read(ref address);
620public static void VolatileWrite(ref byte address, byte value) => Volatile.Write(ref address, value);
623public static void VolatileWrite(ref double address, double value) => Volatile.Write(ref address, value);
626public static void VolatileWrite(ref short address, short value) => Volatile.Write(ref address, value);
629public static void VolatileWrite(ref int address, int value) => Volatile.Write(ref address, value);
632public static void VolatileWrite(ref long address, long value) => Volatile.Write(ref address, value);
635public static void VolatileWrite(ref nint address, nint value) => Volatile.Write(ref address, value);
638public static void VolatileWrite([NotNullIfNotNull(nameof(value))] ref object? address, object? value) => Volatile.Write(ref address, value);
642public static void VolatileWrite(ref sbyte address, sbyte value) => Volatile.Write(ref address, value);
645public static void VolatileWrite(ref float address, float value) => Volatile.Write(ref address, value);
649public static void VolatileWrite(ref ushort address, ushort value) => Volatile.Write(ref address, value);
653public static void VolatileWrite(ref uint address, uint value) => Volatile.Write(ref address, value);
657public static void VolatileWrite(ref ulong address, ulong value) => Volatile.Write(ref address, value);
661public static void VolatileWrite(ref nuint address, nuint value) => Volatile.Write(ref address, value);
System.Reflection.Metadata (1)
System.Reflection.MetadataLoadContext (8)
System.Security.Cryptography (2)
System.Text.Encodings.Web (2)
System.Text.Json (11)
System.Text.RegularExpressions (11)
System.Threading (3)
System.Threading.Channels (3)
System.Threading.Tasks.Dataflow (14)
System.Threading.Tasks.Parallel (2)
System.Xaml (2)
Test.Utilities (13)
Text.Analyzers (13)