Skip to content

Commit

Permalink
Added inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmk committed Jan 29, 2024
1 parent 3efe37c commit 2404ff3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/NATS.Client.Core/Commands/CommandWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ public async ValueTask UnsubscribeAsync(int sid, int? maxMsgs, CancellationToken
[MethodImpl(MethodImplOptions.NoInlining)]
private static void ThrowOnDisconnected() => throw new NatsException("Connection hasn't been established yet.");

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private PipeWriter GetWriter()
{
lock (_lock)
Expand Down Expand Up @@ -287,12 +288,14 @@ private async ValueTask PublishLockedAsync(string subject, string? replyTo, Nat
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private ValueTask<int> UnLockAsync(CancellationToken cancellationToken)
{
Interlocked.Decrement(ref _counter.PendingMessages);
return _channelLock.Reader.ReadAsync(cancellationToken);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private ValueTask LockAsync(CancellationToken cancellationToken)
{
Interlocked.Increment(ref _counter.PendingMessages);
Expand Down

0 comments on commit 2404ff3

Please sign in to comment.