go_to_isolate 1.0.0 copy "go_to_isolate: ^1.0.0" to clipboard
go_to_isolate: ^1.0.0 copied to clipboard

A isolate thread pool.

go #

This is not a Go Language Repository.

This is a isolate thread pool library for dart.

Usage #

A simple usage example:

import 'dart:async';

import 'package:go/go.dart';

Future<void> main() async {
  try {
    await Pool.init();
  } catch (e) {
    print(e);
  }

  final results = <Completer<int>>[];
  for (var i = 0; i < 10000; i++) {
    results.add(Pool.go(sum1000));
  }

  for (var i = 0; i < results.length; i++) {
    print("sum($i): ${await results[i].future}");
  }

  await Pool.close();
}

int sum1000() {
  var sum = 0;
  for (var i = 0; i < 1000; i++) {
    sum += i;
  }
  return sum;
}
1
likes
130
points
46
downloads

Publisher

unverified uploader

Weekly Downloads

A isolate thread pool.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MPL-2.0 (license)

More

Packages that depend on go_to_isolate