Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
mongo dart bug in isolate. Illegal instruction: 4
#import("dart:isolate");
#import('../../mongo-dart/lib/mongo.dart');
/*
1) Clone the mongo dart project and reference the correct import location
2) dart test_isolate.dart
13:37:00-adam@Adams-MacBook-Air:~/dart/test
$ dart test_isolate.dart
enter find
Illegal instruction: 4
*/
// class used for simple async class
class AnotherAsyncClass {
Future open() {
Completer c = new Completer();
c.complete("blamamal");
return c.future;
}
}
Future<String> find(msg) {
print("enter find");
Completer completer = new Completer();
// Creates the following error: Illegal instruction: 4
Db db = new Db('some-db-test');
completer.complete("some dummy data, comment out to test db.open() or a.open()");
// DbCollection collection;
// AnotherAsyncClass a = new AnotherAsyncClass();
// a.open().then((_) {
//
// });
// print("before db.open in find");
// db.open().chain((_){
// print("open db in find");
// collection = db.collection("somecollection");
// return collection.findOne({"somefield":msg});
// }).chain((v){
// completer.complete(v);
// });
print("ret find");
return completer.future;
}
new_isolate() {
port.receive((msg, reply) {
Future f = find(msg);
f.handleException((e)=>print("e = ${e}"));
f.then((r)=>reply.send(r));
});
}
main() {
spawnFunction(new_isolate).call("findme").then((s)=>print("s=$s"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.