Is it safe to use the ContinueWith(...)
method on a TaskCompletionSource.Task
if the TaskCompletionSource.SetResult(...)
has already been
If the specified task has already completed by the time ContinueWith is called, the synchronous continuation will run on the thread calling ContinueWith. https://msdn.microsoft.com/en-us/library/dd321576(v=vs.110).aspx
Yes this should be fine, ContinueWith checks if the previous task completed or not, if so it will immediately queue up the continuation.