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

[Feature Request] Expose HalfSerializer for public use? #2032

Open
jeffijoe opened this issue Nov 6, 2023 · 0 comments
Open

[Feature Request] Expose HalfSerializer for public use? #2032

jeffijoe opened this issue Nov 6, 2023 · 0 comments

Comments

@jeffijoe
Copy link

jeffijoe commented Nov 6, 2023

I recently had a case where I was building an observable wrapper over a module where OnNext would be guaranteed to be called serially, while OnCompleted/OnError may be called concurrently.

Since I knew OnCompleted/OnError would not be called frequently, I used a SpinLock where the OnNext path would use TryEnter (non-blocking) and the OnComplete/OnError would use Enter (spin-waiting), and this works fine given my situation.

I later went digging through the Rx.NET source and found this absolute gem by the name of HalfSerializer which is exactly what I needed for my use case! The implementation is very elegant and completely non-blocking. 🤩

Would it be possible to expose a thin wrapper around it that allows me to pass in an IObserver<T> rather than ISink<T>?

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

1 participant