in src/DotPulsar/Internal/Channel.cs [71:111]
public void ReachedEndOfTopic()
=> _eventRegister.Register(new ChannelReachedEndOfTopic(_correlationId));
public void Unsubscribed()
=> _eventRegister.Register(new ChannelUnsubscribed(_correlationId));
public IDisposable SenderLock()
=> _senderLock.Enter();
private sealed class Lock : IDisposable
{
private readonly object _lock;
private bool _canSend;
public Lock()
{
_lock = new object();
_canSend = true;
}
public void Disable()
{
Monitor.Enter(_lock);
_canSend = false;
Monitor.Exit(_lock);
}
public IDisposable Enter()
{
Monitor.Enter(_lock);
if (_canSend)
return this;
Monitor.Exit(_lock);
throw new OperationCanceledException();
}
public void Dispose()
=> Monitor.Exit(_lock);
}