Check if task is already running before starting new

As suggested by Jon Skeet, the Task.IsCompleted is the better option.

According to MSDN:

IsCompleted will return true when the task is in one of the three
final states: RanToCompletion, Faulted, or Canceled.

But it appears to return true in the TaskStatus.WaitingForActivation state too.

Leave a Comment