Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CookieCrumble/src/CookieCrumble/Snapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace CookieCrumble;

public class Snapshot
{
#if NET10_0_OR_GREATER
#if NET9_0_OR_GREATER
private static readonly Lock s_sync = new();
#else
private static readonly object s_sync = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ namespace GreenDonut.Data.Cursors;
/// </summary>
public static class CursorKeySerializerRegistration
{
#if NET9_0_OR_GREATER
private static readonly Lock s_sync = new();
#else
private static readonly object s_sync = new();
#endif

private static ICursorKeySerializer[] s_serializers =
[
Expand Down
4 changes: 4 additions & 0 deletions src/GreenDonut/src/GreenDonut/DataLoaderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ public abstract partial class DataLoaderBase<TKey, TValue>
: IDataLoader<TKey, TValue>
where TKey : notnull
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private readonly IBatchScheduler _batchScheduler;
private readonly int _maxBatchSize;
private readonly IDataLoaderDiagnosticEvents _diagnosticEvents;
Expand Down
4 changes: 4 additions & 0 deletions src/GreenDonut/src/GreenDonut/PromiseCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ namespace GreenDonut;
public sealed class PromiseCache : IPromiseCache
{
private const int MinimumSize = 10;
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private readonly ConcurrentDictionary<PromiseCacheKey, Entry> _map = new();
private readonly ConcurrentDictionary<Type, ImmutableArray<Subscription>> _subscriptions = new();
private readonly List<IPromise> _promises = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ public sealed class TestMcpStorage : IMcpStorage, IDisposable
private ImmutableList<ObserverSession<PromptStorageEventArgs>> _promptSessions = [];
private ImmutableList<ObserverSession<OperationToolStorageEventArgs>> _toolSessions = [];
private bool _disposed;
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif

public async ValueTask<IEnumerable<PromptDefinition>> GetPromptDefinitionsAsync(
CancellationToken cancellationToken = default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ namespace HotChocolate.Transport.Sockets.Client.Protocols;

internal sealed class MessageStream : IObservable<IOperationMessage>, IObserver<IOperationMessage>
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private ImmutableList<Subscription> _subscriptions = [];

public IDisposable Subscribe(IObserver<IOperationMessage> observer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ internal sealed class AzureHttpResponse : HttpResponse
private ImmutableList<(Func<object, Task>, object)> _onCompletedCallbacks = [];
private readonly HttpResponse _response;
private readonly HttpRequestData _requestData;
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private HttpResponseData? _responseData;
private AzureHeaderDictionary? _headers;
private PipeWriter? _writer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ namespace HotChocolate.Subscriptions.Postgres;

internal sealed class CopyOnWriteList<T> where T : class
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif

private T[] _items = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ public static class PooledObjects
new ConcurrentDictionary<string, string>[8];
private static int s_nextStringDictionaryIndex = -1;

#if NET9_0_OR_GREATER
private static readonly Lock s_lock = new();
#else
private static readonly object s_lock = new();
#endif

public static StringBuilder GetStringBuilder()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ namespace HotChocolate.Execution.Processing;

internal sealed class AsyncManualResetEvent : INotifyCompletion
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private Action? _continuation;
private bool _continue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ namespace HotChocolate.Execution.Processing;

internal sealed partial class DeferExecutionCoordinator
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private readonly Dictionary<DeferredBranchKey, int> _branchIdLookup = [];
private readonly Dictionary<int, DeferredBranch> _branchLookup = [];
private HashSet<int>? _mainBranchChildren;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ namespace HotChocolate.Execution;

internal sealed class OperationResultBuilder : IOperationResultBuilder
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif

public int RequestIndex { get; set; } = -1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ namespace HotChocolate.Execution.Processing;

internal sealed partial class WorkScheduler(OperationContext operationContext)
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private readonly WorkQueue _work = new();
private readonly WorkQueue _serial = new();
private readonly AsyncManualResetEvent _signal = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ namespace HotChocolate.Fetching;

internal sealed class AsyncAutoResetEvent : INotifyCompletion
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private Action? _continuation;
private bool _isSignaled;

Expand Down
4 changes: 4 additions & 0 deletions src/HotChocolate/Core/src/Types/Fetching/BatchDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ namespace HotChocolate.Fetching;
public sealed partial class BatchDispatcher : IBatchDispatcher
{
private readonly AsyncAutoResetEvent _signal = new();
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private readonly HashSet<Batch> _enqueuedBatches = [];
private readonly CancellationTokenSource _coordinatorCts = new();
private readonly IDataLoaderDiagnosticEvents _diagnosticEvents;
Expand Down
4 changes: 4 additions & 0 deletions src/HotChocolate/Core/src/Types/Internal/TypeCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ namespace HotChocolate.Internal;

internal sealed class TypeCache
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private readonly Dictionary<ExtendedTypeId, ExtendedType> _types = [];
private readonly Dictionary<object, ExtendedType> _typeMemberLookup = [];
private readonly Dictionary<ExtendedTypeId, TypeInfo> _typeInfos = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ namespace HotChocolate.Types.Descriptors;
/// </summary>
public sealed class TypeConfigurationContainer
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private readonly HashSet<string> _created = [];
private readonly Dictionary<Type, List<object>> _configurations = [];
private readonly Dictionary<string, List<object>> _namedConfigurations = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ public class Mutation1
private int _order;
private bool _a;
private bool _b;
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif

public async Task<int> A()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ public class TestChannel : IDisposable
private readonly NpgsqlConnection _connection;
private readonly string _channelName;
private readonly Func<NpgsqlConnection> _connectionFactory;
#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif

public List<string> ReceivedMessages { get; } = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,11 @@ public async Task Integration_CodeFirst_InputObjectNoDefaultValue_NoRuntimeTypeD

private class ResolverArgumentsAccessor
{
#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif
internal SortedDictionary<string, IDictionary<string, object?>?> Arguments { get; } = new();

internal string? ResolveWith(IDictionary<string, object?> args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ namespace HotChocolate.Fusion.Execution;

internal sealed class AsyncAutoResetEvent : INotifyCompletion
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private Action? _continuation;
private bool _isSignaled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ namespace HotChocolate.Fusion.Execution.Clients;

public sealed class DefaultSourceSchemaClientScope : ISourceSchemaClientScope
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private readonly ConcurrentDictionary<(string Name, OperationType Type), ISourceSchemaClient> _clients = [];
private readonly IHttpClientFactory _httpClientFactory;
private readonly SourceSchemaClientConfigurations _configurations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,11 @@ private void DisposeNodeState()

private sealed class NodeCompletionSet(int bitsetWordCount) : IDisposable
{
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private ExecutionNode[] _dependents = [];
private ulong[]? _seenDependents;
private int _count;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ public RavenPagingContainer<TEntity> Take(int take)

private sealed class TaskHolder
{
#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif
private Task<int>? _task;
private readonly Func<Task<int>> _factory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ namespace Mocha.Transport.InMemory;
public sealed class InMemoryMessagingTopology(InMemoryMessagingTransport transport, Uri baseAddress)
: MessagingTopology<InMemoryMessagingTransport>(transport, baseAddress)
{
#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif
private readonly List<InMemoryTopic> _topics = [];
private readonly List<InMemoryQueue> _queues = [];
private readonly List<InMemoryBinding> _bindings = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ public sealed class PostgresMessagingTopology(
bool autoProvision)
: MessagingTopology<PostgresMessagingTransport>(transport, address)
{
#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif
private readonly List<PostgresTopic> _topics = [];
private readonly List<PostgresQueue> _queues = [];
private readonly List<PostgresSubscription> _subscriptions = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ public sealed class RabbitMQMessagingTopology(
bool autoProvision)
: MessagingTopology<RabbitMQMessagingTransport>(transport, baseAddress)
{
#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif
private readonly List<RabbitMQExchange> _exchanges = [];
private readonly List<RabbitMQQueue> _queues = [];
private readonly List<RabbitMQBinding> _bindings = [];
Expand Down
4 changes: 4 additions & 0 deletions src/Mocha/src/Mocha/Consumers/Batching/BatchCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ internal sealed class BatchCollector<TEvent> : IAsyncDisposable
private readonly Func<MessageBatch<TEvent>, ValueTask> _onBatchReady;
private readonly int _maxBatchSize;

#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private readonly DelayedAction _delay;
private List<BufferedEntry<TEvent>> _buffer = [];
private bool _disposed;
Expand Down
4 changes: 4 additions & 0 deletions src/Mocha/src/Mocha/Endpoints/EndpointRouter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ namespace Mocha;
/// </summary>
public sealed class EndpointRouter : IEndpointRouter
{
#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif

// Primary storage - endpoint -> tracked addresses
private readonly Dictionary<DispatchEndpoint, ImmutableHashSet<Uri>> _endpoints = [];
Expand Down
4 changes: 4 additions & 0 deletions src/Mocha/src/Mocha/MessageTypes/IMessageRouter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ DispatchEndpoint GetEndpoint(
/// </summary>
public sealed class MessageRouter : IMessageRouter
{
#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif

// Inbound storage and indexes
private readonly Dictionary<InboundRoute, InboundTrackedState> _inboundRoutes = [];
Expand Down
4 changes: 4 additions & 0 deletions src/Mocha/src/Mocha/Serialization/MessageTypeRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ public sealed class MessageTypeRegistry(IMessageSerializerRegistry serializerReg
{
public IMessageSerializerRegistry Serializers => serializerRegistry;

#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif
private readonly HashSet<MessageType> _messageTypes = [];
private readonly Dictionary<Type, MessageType> _messageTypesByType = [];
private readonly Dictionary<string, MessageType> _messageTypesByIdentity = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ namespace Mocha.EntityFrameworkCore.Postgres.Tests.Helpers;
/// </summary>
internal sealed class ResilientOutboxSignal : IOutboxSignal
{
#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif
private TaskCompletionSource _tcs;

public ResilientOutboxSignal()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,11 @@ private sealed class StubConsumeContext(TestEvent message, string? messageId = n
private sealed class BatchRecorder<TEvent>
{
private readonly SemaphoreSlim _semaphore = new(0);
#if NET9_0_OR_GREATER
private readonly Lock _sync = new();
#else
private readonly object _sync = new();
#endif
private readonly List<MessageBatch<TEvent>> _batches = [];

public IReadOnlyList<MessageBatch<TEvent>> Batches
Expand Down
Loading
Loading