in src/DotPulsar/Internal/AsyncQueueWithCursor.cs [43:68]
public async ValueTask Enqueue(T item, CancellationToken cancellationToken)
{
try
{
var grant = await _pendingLock.Lock(cancellationToken).ConfigureAwait(false);
lock (_pendingLock)
{
_pendingLockGrant = grant;
}
}
catch (Exception)
{
ReleasePendingLockGrant();
throw;
}
lock (_queue)
{
ThrowIfDisposed();
var node = _queue.AddLast(item);
_cursorNextItemTcs?.TrySetResult(node);
if (_queue.Count < _maxItems)
ReleasePendingLockGrant();
}
}