File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -99,10 +99,9 @@ impl KernelModule for RustExample {
99
99
let cv = Pin :: from ( Box :: try_new ( unsafe { CondVar :: new ( ) } ) ?) ;
100
100
condvar_init ! ( cv. as_ref( ) , "RustExample::init::cv1" ) ;
101
101
{
102
- let guard = data. lock ( ) ;
103
- #[ allow( clippy:: while_immutable_condition) ]
102
+ let mut guard = data. lock ( ) ;
104
103
while * guard != 10 {
105
- let _ = cv. wait ( & guard) ;
104
+ let _ = cv. wait ( & mut guard) ;
106
105
}
107
106
}
108
107
cv. notify_one ( ) ;
@@ -122,10 +121,9 @@ impl KernelModule for RustExample {
122
121
let cv = Pin :: from ( Box :: try_new ( unsafe { CondVar :: new ( ) } ) ?) ;
123
122
condvar_init ! ( cv. as_ref( ) , "RustExample::init::cv2" ) ;
124
123
{
125
- let guard = data. lock ( ) ;
126
- #[ allow( clippy:: while_immutable_condition) ]
124
+ let mut guard = data. lock ( ) ;
127
125
while * guard != 10 {
128
- let _ = cv. wait ( & guard) ;
126
+ let _ = cv. wait ( & mut guard) ;
129
127
}
130
128
}
131
129
cv. notify_one ( ) ;
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ impl CondVar {
65
65
///
66
66
/// Returns whether there is a signal pending.
67
67
#[ must_use = "wait returns if a signal is pending, so the caller must check the return value" ]
68
- pub fn wait < L : Lock > ( & self , guard : & Guard < L > ) -> bool {
68
+ pub fn wait < L : Lock > ( & self , guard : & mut Guard < L > ) -> bool {
69
69
let lock = guard. lock ;
70
70
let mut wait = MaybeUninit :: < bindings:: wait_queue_entry > :: uninit ( ) ;
71
71
You can’t perform that action at this time.
0 commit comments