[Feature Request] Expose `HalfSerializer` for public use?
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 798
- PR merge metrics
- No merged PRs in 30d
Description
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`](https://github.com/dotnet/reactive/blob/main/Rx.NET/Source/src/System.Reactive/Internal/HalfSerializer.cs) 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` rather than `ISink`?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.