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); }
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); }