Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use package:typed_isolate for easier isolate management #43

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Levi-Lesches
Copy link

@Levi-Lesches Levi-Lesches commented Nov 13, 2024

Hi @netdur! I saw your comment on Reddit about isolates, and I saw a reply offering to rewrite that part with package:actors, so as author of package:typed_isolate I thought I'd step in and give it a shot.

Basically, instead of managing the main isolate and model isolate in one class, I created three files:

  • isolate_types.dart: defines the payloads sent back and forth between the two isolates
  • isolate_parent.dart: an object that lives in the main isolate that is responsible for communicating with the model isolate
  • isolate_child.dart: a new isolate to hold the model and communicate back with the parent

I wasn't sure if you were using to/from JSON for anything else, but if not, you can remove those too. Feel free to ignore this, but hopefully it makes your code clearer! I'm also looking for feedback for the package so if you see anything you wish were different please let me know!

@Levi-Lesches Levi-Lesches changed the title Use typed_isolate for easier isolate management Use package:typed_isolate for easier isolate management Nov 13, 2024
@netdur netdur self-requested a review November 18, 2024 13:12
@netdur
Copy link
Owner

netdur commented Nov 18, 2024

Thank you @Levi-Lesches I am in middle of updating package with llama.cpp I will review your improvements

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

Successfully merging this pull request may close these issues.

2 participants