Ejemplo n.º 1
0
        public void ScheduleSend(Action <bool> whenDone)
        {
            if (trace.IsEnabled())
            {
                trace.SendStart(name, IsAlive, sendBuffer.Position);
            }

            if (!IsAlive)
            {
                whenDone(false);
                return;
            }

            IsBusy             = true;
            sendArgs.UserToken = whenDone;

            PerformSend(sendBuffer.BufferOffset, sendBuffer.Position);
        }
Ejemplo n.º 2
0
        public bool ScheduleSend(Action <bool> whenDone)
        {
            CoreEventSource.SendStart(name, IsAlive, sendBuffer.Position);

            if (!IsAlive)
            {
                whenDone(false);
                return(false);
            }

            if (Interlocked.CompareExchange(ref isSending, 1, 0) != 0)
            {
                return(false);
            }

            sendArgs.UserToken = whenDone;
            PerformSend(sendBuffer.BufferOffset, sendBuffer.Position);

            return(true);
        }