Future<T> run<T>(Task task) async { var ts = _Task<T>(++id, task as Future<T> Function(), Completer<T>()); _tasks.add(ts); _schedule(); return ts.completer.future; }