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

Nice crate! #1

Open
madsmtm opened this issue Oct 28, 2024 · 2 comments
Open

Nice crate! #1

madsmtm opened this issue Oct 28, 2024 · 2 comments

Comments

@madsmtm
Copy link

madsmtm commented Oct 28, 2024

Hey Drew!

I've been looking into the async story in objc2 today (madsmtm/objc2#279), gonna open a few issues (and later on probably PRs) in this repo because I believe you've taken the right approach in splitting this out from blockr to be generally applicable, and this'll be a useful crate for me to recommend to objc2 async users in the future.

Feel free to say so if you don't intend for this crate to be used by the wider ecosystem / gain that kind of "publicity" (with the effort that entails), then I'll go a different approach.

(Btw, thanks for making the license in your objr repos more permissive).

@madsmtm
Copy link
Author

madsmtm commented Oct 29, 2024

Oh, just found out that oneshot exists, might end up using that instead, not yet sure.

@drewcrawford
Copy link
Owner

Hi mads, glad you found it useful so far.

I was unaware of oneshot as well. Taking a glance at it I think the key differences are:

  • continue has first-class support for running code on cancel. I think oneshot needs a wrapper for this? Personally I think going batteries-included on this is the way to go.
  • oneshot has first-class support for blocking reads. continue would need a wrapper to do this. Personally I think going batteries-sold-separately on this is the way to go
  • panic vs error, more in Propagate panics cleanly #7
  • There are some different choices which lead to differing performance. For example oneshot hand-rolls its atomic-waker like capability, which ought to be a bit better. But in doing so it over-clones wakers, which ought to be a bit worse.

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