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

Mutex in different isolates #9

Closed
DasElias opened this issue Jan 8, 2022 · 1 comment
Closed

Mutex in different isolates #9

DasElias opened this issue Jan 8, 2022 · 1 comment

Comments

@DasElias
Copy link

DasElias commented Jan 8, 2022

Is it possible to share a Mutex through different isolates?

@hoylen
Copy link
Owner

hoylen commented Jan 8, 2022

No. Not directly, since a mutex object is state that is stored in memory.

From the concurrency guide, "Each isolate has its own memory heap, ensuring that none of the state in an isolate is accessible from any other isolate. Because there’s no shared memory, you don’t have to worry about mutexes or locks."

A possible solution is to have only one mutex instantiated in an isolate (possibly the main isolate), and the other isolates interacts with that isolate via messages. That is, "sharing the mutex" by actually "sharing the isolate it is in".

@hoylen hoylen closed this as completed Jan 8, 2022
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

No branches or pull requests

2 participants