示例#1
0
        /// <summary>
        /// Writes to master.
        /// </summary>
        /// <param name="pkg">Package to send to master.</param>
        public void WriteToMaster(PackageBase pkg)
        {
            if (_writeThread.Count == 0)
            {
                return;
            }

            _writeThread [0].Add(pkg.getMessage());
        }
示例#2
0
 /// <summary>
 /// Writes to all slaves.
 /// </summary>
 /// <param name="pkg">Pakage to send to all slaves.</param>
 public void WriteToAllSlave(PackageBase pkg)
 {
     byte [] message = pkg.getMessage();
     for (int i = 0; i < _writeThread.Count; i++)
     {
         if (_writeThread [i] != null)
         {
             _writeThread [i].Add(message);
         }
     }
     if (pkg == EnPackageType.TERMINATE && _writeThread.Count > 0)
     {
         lock (_monitorMaster) {
             Monitor.Wait(_monitorMaster);
         }
     }
 }