Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.

Calling Isolate.spawn thows Unsupported operation #3

Closed
Cedware opened this issue Jun 1, 2016 · 3 comments
Closed

Calling Isolate.spawn thows Unsupported operation #3

Cedware opened this issue Jun 1, 2016 · 3 comments

Comments

@Cedware
Copy link

Cedware commented Jun 1, 2016

I have a simple dummy function:

void count(int num){ int x = num+1; }

which I'm calling with Isolate.spawn:

Isolate.spawn(count,100);

This causing this exception:

EXCEPTION: Unsupported operation: Isolate.spawn(anonymous function) @ VM63:1
VM63:1 STACKTRACE:(anonymous function) @ VM63:1
VM63:1 #0 Isolate.spawn.<spawn_async_body> (dart:isolate-patch/isolate_patch.dart:326)

1 Future.Future.microtask. (dart:async/future.dart:144)

2 _rootRun (dart:async/zone.dart:891)

3 _ZoneDelegate.run (dart:async/zone.dart:490)

4 NgZoneImpl._run (package:angular2/src/core/zone/ng_zone_impl.dart:154:21)

5 _CustomZone.run (dart:async/zone.dart:790)

6 _CustomZone.runGuarded (dart:async/zone.dart:696)

7 _CustomZone.bindCallback. (dart:async/zone.dart:721)

8 NgZoneImpl._scheduleMicrotask. (package:angular2/src/core/zone/ng_zone_impl.dart:174:11)

9 _rootRun (dart:async/zone.dart:895)

10 _ZoneDelegate.run (dart:async/zone.dart:490)

11 NgZoneImpl._run (package:angular2/src/core/zone/ng_zone_impl.dart:154:21)

12 _CustomZone.run (dart:async/zone.dart:790)

13 _CustomZone.runGuarded (dart:async/zone.dart:696)

14 _CustomZone.bindCallback. (dart:async/zone.dart:721)

15 _microtaskLoop (dart:async/schedule_microtask.dart:41)

16 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)

17 _ScheduleImmediateHelper._handleMutation (dart:html:49290)

@lrhn
Copy link
Contributor

lrhn commented Jun 1, 2016

Where is the dummy function declared? Is it a top-level or static function, or is it declared locally in another function. Only top-level and static functions are allowed as argument to Isolate.spawn.

@Cedware
Copy link
Author

Cedware commented Jun 3, 2016

Is definitively a top-level function it's declared in the main.dart file with no class around it and it's directly called from the main function of the same file

@alan-knight
Copy link

dart-lang/sdk#17649

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants