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

put only allows a single message but no way to determine if mailbox is full #10

Open
bsutton opened this issue Mar 29, 2024 · 1 comment

Comments

@bsutton
Copy link

bsutton commented Mar 29, 2024

I'm trying to use mailbox to implement a replacement for waitFor when running process.

The problem I'm encountering is that a mailbox only allows a single message at time.

Ignoring the performance concerns for a moment my immediate problem is that when I call put it throws an error saying the mailbox is full (the second time put is called). It looks like the api provides no way to determine if the mailbox is full which means I have to call put and then capture an exception which, whilst it works, really doesn't feel like the correct approach.

So in the end I guess to questions:

  1. should the api have a method to determine if the mailbox is full?
  2. should the mailbox allow more than a single message at a time?

Allowing multiple messages would seem to be more performant.

@bsutton
Copy link
Author

bsutton commented Mar 29, 2024

From a performance perspective I should note that currently all I can do, after a put fails, is to make the writer sleep for an arbitrary amount of time and then try to put message into the mailbox again. This is really going to hurt performance.

@devoncarew devoncarew transferred this issue from dart-archive/native_synchronization Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants