Пример #1
0
        private void write()
        {
            lock (m_Destinations) //the lock on destinations here is on purpose, so while write takes place no other thread can remove destinations
            {
                Message msg;
                while (m_Queue.TryDequeue(out msg))
                {
                    if (m_InstrumentationEnabled)
                    {
                        _stat s;
                        if (!m_Stats.TryGetValue(msg.Type, out s))
                        {
                            s = new _stat();
                            m_Stats[msg.Type] = s;
                        }
                        s.V++;
                    }

                    foreach (var destination in m_Destinations)
                    {
                        //20130318 DKh
                        if (!m_Reliable && !this.Running)
                        {
                            return;
                        }
                        destination.Send(msg);
                    }
                }
            }
        }
Пример #2
0
        private int write(bool all = false)
        {
            const int SLICE_MSG_COUNT = 10;

            Message msg;
            int     written = 0;

            while (m_Queue.TryDequeue(out msg))
            {
                written++;

                if (m_InstrumentationEnabled)
                {
                    _stat s;
                    if (!m_Stats.TryGetValue(msg.Type, out s))
                    {
                        s = new _stat();
                        m_Stats[msg.Type] = s;
                    }
                    s.V++;
                }

                foreach (var sink in m_Sinks.OrderedValues)
                {
                    if (!Reliable && !this.Running)
                    {
                        break;
                    }

                    sink.Send(msg);
                }

                if (!all && written == SLICE_MSG_COUNT)
                {
                    break;
                }
            }

            return(written);
        }
Пример #3
0
        private void write()
        {
            lock (m_Destinations) //the lock on destinations here is on purpose, so while write takes place no other thread can remove destinations
            {
                Message msg;
                while (m_Queue.TryDequeue(out msg))
                {
                    if (m_InstrumentationEnabled)
                    {
                      _stat s;
                      if (!m_Stats.TryGetValue(msg.Type, out s))
                      {
                       s = new _stat();
                       m_Stats[msg.Type] = s;
                      }
                      s.V++;
                    }

                    foreach (var destination in m_Destinations)
                    {
                        //20130318 DKh
                        if (!m_Reliable && !this.Running)
                            return;
                        destination.Send(msg);
                    }
                }
            }
        }
Пример #4
0
 set => SetProperty(ref _stat, value);