Beispiel #1
0
 /// <summary>
 /// 移除一个数据监视的任务
 /// </summary>
 /// <param name="monitor"></param>
 public void RemoveSubcrption(ModBusMonitorAddress monitor)
 {
     subcriptionHybirdLock.Enter();
     subscriptions.Remove(monitor);
     subcriptionHybirdLock.Leave();
 }
Beispiel #2
0
        private SimpleHybirdLock subcriptionHybirdLock;       // 集合锁

        /// <summary>
        /// 新增一个数据监视的任务,针对的是寄存器
        /// </summary>
        /// <param name="monitor">监视地址对象</param>
        public void AddSubcription(ModBusMonitorAddress monitor)
        {
            subcriptionHybirdLock.Enter();
            subscriptions.Add(monitor);
            subcriptionHybirdLock.Leave();
        }