Repository navigation
Conversation
left a comment
There was a problem hiding this comment.
Looks good. I will merge it in a while in case @alex wants to take a final look.
commented
Mar 15, 2021
|
I don't feel like I know the relevant kernel APIs well enough, so please don't wait on my account. |
| condvar_init!(cv.as_ref(), "RustExample::init::cv1"); | ||
| { | ||
| let guard = data.lock(); | ||
| #[allow(clippy::while_immutable_condition)] |
There was a problem hiding this comment.
Question: will this make the following read on guard volatile? IOW, could there be anything that stops the compiler from optimizing the following code as
let c = *guard;
while c != 10{
cv.wait(&guard);
}
There was a problem hiding this comment.
I believe the the interior mutability implied by the use of UnsafeCell prevents the compiler from assuming that *guard won't change: it calls deref(), which calls locked_data() from the underlying lock, which returns an UnsafeCell.
Fix comment. Co-authored-by: Miguel Ojeda <ojeda@users.noreply.github.com>
commented
Mar 16, 2021
|
I was about to merge it, sorry -- I am juggling different things now. Please don't hesitate to ping me if needed. |
This is on top of #103.