anchor.diff:    TaskState = enum(Created, Queued, Started, Done) of Integer;
     TaskBlock = public block();
     TaskBlockGen<T> = public block(): T;
  +
  +  TaskCompletionSource<T> = public __ElementsTaskCompletionSource<T>;
  +  Task = public __ElementsTask;
  +  Task1<T> = public __ElementsTask1<T>;
  +  
     __ElementsTask = public class
     assembly
       fState: TaskState;
  
positive.code: begin
    fLock.lock;
    try
      if fState <> TaskState.Created then raise new NSException withName(NSInvalidArgumentException) reason('Task already started/queued/done') userInfo(nil);
      fState := TaskState.Queued;
    finally
      fLock.unlock;
    end;
  
    dispatch_async(coalesce(aScheduler, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)), -> run());
  end;
  
  class method __ElementsTask.Run(aIn: TaskBlock): __ElementsTask;
  
negative.code: method __ElementsTask.AddOrRunContinueWith(aTask: __ElementsTask);
  begin
    var lDone := false;
    if fState = TaskState.Done then begin
      lDone := true
    end
    else locking self do begin
      if fState = TaskState.Done then begin
        lDone := true
      end
      else if fDoneHandlers = nil then begin
        fDoneHandlers := aTask
      end
      else begin
        var lNew := new NSMutableArray<__ElementsTask>();
        lNew.addObject(duck<__ElementsTask>(fDoneHandlers));
        lNew.addObject(aTask);
        fDoneHandlers := lNew;
      end;
    end;
    if lDone then begin
      aTask.DoRun;
    end;
  end;
  
  