예제 #1
0
        public void AddNotification(DeadManSwitchNotification deadManSwitchNotification)
        {
            Interlocked.Exchange(ref _lastNotifiedTicks, DateTime.UtcNow.Ticks);

            lock (_notificationsSyncRoot)
            {
                _notifications[_notificationsNextItemIndex] = deadManSwitchNotification;
                _notificationsNextItemIndex = (_notificationsNextItemIndex + 1) % _notifications.Length;
            }
        }
예제 #2
0
 public ValueTask AddNotificationAsync(DeadManSwitchNotification deadManSwitchNotification, CancellationToken cancellationToken)
 {
     return(_notificationsWriter.WriteAsync(deadManSwitchNotification, cancellationToken));
 }