Example #1
0
 void Remove(WatchDogSession session)
 {
     if (session == null)
     {
         throw new ArgumentNullException(nameof(session));
     }
     lock (_syncRoot)
     {
         if (_sessions.Contains(session))
         {
             _sessions.Remove(session);
         }
     }
 }
Example #2
0
        public IWatchDogSession Watch(IDisposable member)
        {
            if (member == null)
            {
                throw new ArgumentNullException(nameof(member));
            }

            var membership = new WatchDogSession(member, Remove, _clock);

            lock (_syncRoot)
            {
                _sessions.Add(membership);
            }
            return(membership);
        }