-
-
Notifications
You must be signed in to change notification settings - Fork 80
Should we combine the Channel
and the Sender
types?
#311
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
Comments
It's been a while since I wrote this, but I believe the |
|
Wouldn't that create a race condition where it could be possible that the channel is dropped before the other thread received the message? The |
Perhaps, I think about the following sequence:
Would it make sense to possibly allow storing the channel within the relm context, given that in most usecases this will be the lifetime of the channel and that the channel is tied to the relm stream? fwiw, I think about |
I'm not sure I understand what you suggest. Could you please provide a code example and what it would generate? |
When writing multithreaded core, using channels is quite messy. For each channel, you need to store both the channel (which you will never touch afterwards) and the sender (which is the one you use). In real-life examples, where CPU-intensive operation are triggered by the interactions with the UI, both need to be stored in the model. This feels quite messy.
Is there any reason against combining these two types into a single one?
The text was updated successfully, but these errors were encountered: