Uh oh!
There was an error while loading. Please reload this page.
TRPL: dining philosophers - #25321
Conversation
rust-highfive
commented
May 12, 2015
(rust_highfive has picked a reviewer for you, use r? to override) |
steveklabnik
commented
May 12, 2015
oh, and i might not need the channel at the end: https://twitter.com/florob/status/597935275394912259 considering an extra 'cleanup' section |
e6a6ce0 to
618ef96Comparesteveklabnik
commented
May 12, 2015
I believe all nits are addressed. r? @alexcrichton |
Florob
commented
May 12, 2015
So, maybe I'm just terribly dense, but I still don't see why you need the channel at all. AFAICT, it does not become obsolete by joining the threads, but is unnecessary from the get go. |
There was a problem hiding this comment.
I'm still kinda worried about all these .ok().expect(...) calls throughout these examples, some of them I think may be giving the wrong impression. For example this doesn't really indicate anything about "couldn't finish eating" but rather that no one's listening for the notification that the eating is done. Down below there's:
.ok().expect("Couldn't aquire left mutex");If Err is returned, though, the mutex was indeed acquired, it was just poisoned.
Would it be possible to just use unwrap everywhere? I would consider unwrap as the idiomatic way to indicate that an error should not ever be happening here, and errors should definitely not ever be happening in these examples.
There was a problem hiding this comment.
I guess I've seen people mostly argue that unwrap gives a poor error message, and ok/expect at least lets you customize it.
that said, I'm sympathetic to the last thing you've said, so yeah, let me re-work it.
alexcrichton
commented
May 12, 2015
I do also agree with @Florob that the channel involvement here may not be pulling its weight by the time we get to the end. |
steveklabnik
commented
May 12, 2015
I added a thing at the end about removing the channel entirely. |
steveklabnik
commented
May 12, 2015
@Florob yeah, maybe that is true. sigh. |
618ef96 to
cde1dd6Comparesteveklabnik
commented
May 12, 2015
Okay, I removed the channels entirely, and use unwrap. |
There was a problem hiding this comment.
"and report back that they're done", perhaps drop this phrase?
There was a problem hiding this comment.
nice catch. editing your own prose is so hard :(
This is a little rough, and it needs squashed and section headers, but i'd like to get some eyes on it sooner rather than later.