-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
@aturon so @carllerche and I discussed more during RustConf and I've changed the commit here to do a slight variant of the "handle passing" solution. Instead of one function that takes no handle and one function that takes a handle all functions take handles. My rationale here looks like:
|
|
||
let done = socket.incoming().for_each(move |(socket, addr)| { | ||
let (reader, writer) = socket.split(); | ||
let amt = copy(reader, writer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the interaction here if a user called copy(reader, writer).wait()
in here? Is it like today in that it's a big no-no, and it will likely deadlock the event loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd do the same before/after the rfc, right? In that it'd deadlock the event loop no matter what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, just wanted to be sure, since it sounded like wait
would maybe do some extra "magic", and I wondered if that changed how it would work in here.
I've pushed another commit to avoid breaking |
Having the ability for implicit global handles sounds like probably the right default for most people, so 👍 to that. Here's some assorted thoughts, I would like to try to come up with some solutions to these when I get a chance.
|
ThoughtsA summarization of my thoughts: I/O ReactorThoughts regarding the I/O reactor ( Making
|
@carllerche Thanks much for all of this feedback! @alexcrichton and I had a chance to work through it today and have various thoughts and questions. First, a few easy cases:
Now on to the hairier cases! Passing
|
Do you have anything specific in mind?
If this will be available on stable this year, I think that could be a good option. Otherwise, I think that keeping the handle argument is a lost opportunity.
I'm not sure I follow how this handles the issue of the current thread executor never getting run?
How does a thread become unassociated from the current thread executor?
I don't think calling a free function is a huge burden. Especially since the current thread executor will become a thing, wouldn't you want to block the current thread by running the CurrentThread executor? Where as Anyway, I'm fine opening up the RFC once the write up looks good. |
Also:
I'm not sure I follow what is being said here. The APIs of libs will have a |
I wouldn't want worry of churn to mean a lesser design. If a new design can exist that also happens to prevent churn, that's nice. But a confusing API is worse, IMO. I quite like the proposal to remove it as a usual argument, and put in builder style, like all the rest of configuring a
This seems quite tricky, and still able to lead to obscure bugs, since it still sounds like using
I've had to deal with a large number of reports in the hyper IRC channel and in hyper issues of people using Also, speaking with Oliver about helping engineers who were just trying to get stuff done using Finagle, it was far too common that someone would wait on a future, and block the event loop. The footgun here is more of a footrailgun. People will blow off their entire foot. Maybe a side effort can be to add a lint to clippy to find all instances of calling a blocking API in the context of an event loop thread, and if so, that'd be fantastic. But we also need to save people's feet from themselves. |
I've pushed up a very heavily-revised RFC here. |
Closing in favor of #2 |
Rendered