/// <summary> /// Cancels the task that cancels the underlying tasks as well. /// </summary> public void Cancel() { int len = TcsResponses.Length; for (int i = 0; i < len; i++) { var tcsResponse = TcsResponses.Get(i); if (tcsResponse != null) { tcsResponse.TrySetCanceled(); } } }
/// <summary> /// Gets the TCS at position i. /// </summary> /// <param name="i"></param> /// <returns></returns> public TaskCompletionSource <Message.Message> GetTcsResponse(int i) { return(TcsResponses.Get(i)); }
/// <summary> /// Sets a response at position i to the given value and returns the old response. /// </summary> /// <param name="i"></param> /// <param name="tcsResponse"></param> /// <returns></returns> public TaskCompletionSource <Message.Message> SetTcsResponse(int i, TaskCompletionSource <Message.Message> tcsResponse) { return(TcsResponses.GetAndSet(i, tcsResponse)); }