Exemple #1
0
        public void Enqueue(Broadcast broadcast)
        {
            var tracked = new TrackedBroadcast
            {
                Broadcast = broadcast,
                TransmitCount = 0
            };

            lock (_queueLock)
            {
                _queue.Enqueue(0, tracked);
            }
        }
        public void Broadcast(BroadcastableMessage message, EventWaitHandle @event)
        {
            Debug.Assert(message != null);

            byte[] messageBytes;
            using (var ms = new MemoryStream())
            {
                _messageEncoder.Encode(message, ms);
                messageBytes = ms.ToArray();
            }

            var broadcast = new Broadcast(message, messageBytes, @event);
            _broadcasts.Enqueue(broadcast);
        }