flume icon indicating copy to clipboard operation
flume copied to clipboard

`UnwindSafe` and `RefUnwindSafe` Regarding the channel

Open cwahn opened this issue 5 months ago • 2 comments

I tried to use it as and substitute to mpsc of tokio and found Sender of the Flume is not marked as UnwindSafe and RefUnwindSafe.

When one tries to use this kind of channel for serious application it often matters.

I can see tokio mpsc is only recently marked as UnwindSafe and RefUnwindSafe. Here are some of the related issues

I can see the the root of unsafeness is also the Waker part, namely this line

I see case is quite same with tokio, but not absolutely sure.

@zesterer, how do you think about marking it as UnwindSafe and RefUnwindSafe? Can anyone see any problem when marking it as so?

cwahn avatar Aug 08 '25 06:08 cwahn

I've not looked too closely at the specific requirements of the traits, but I can't imagine anything specific about Flume's implementation that would disallow their implementation, especially for the sync side of the API. Feel free to open a PR!

zesterer avatar Aug 08 '25 10:08 zesterer

Thank you for the fast reply. Indeed the concern is regarding the async situation, as it's around the Waker. Let me investigate a bit more about the Mutex of "spin" before making the PR.

cwahn avatar Aug 08 '25 14:08 cwahn