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 @@ -101,10 +101,9 @@ impl KernelModule for RustExample {
101
101
let cv = Pin :: from ( Box :: try_new ( unsafe { CondVar :: new ( ) } ) ?) ;
102
102
condvar_init ! ( cv. as_ref( ) , "RustExample::init::cv1" ) ;
103
103
{
104
- let guard = data. lock ( ) ;
105
- #[ allow( clippy:: while_immutable_condition) ]
104
+ let mut guard = data. lock ( ) ;
106
105
while * guard != 10 {
107
- let _ = cv. wait ( & guard) ;
106
+ let _ = cv. wait ( & mut guard) ;
108
107
}
109
108
}
110
109
cv. notify_one ( ) ;
@@ -124,10 +123,9 @@ impl KernelModule for RustExample {
124
123
let cv = Pin :: from ( Box :: try_new ( unsafe { CondVar :: new ( ) } ) ?) ;
125
124
condvar_init ! ( cv. as_ref( ) , "RustExample::init::cv2" ) ;
126
125
{
127
- let guard = data. lock ( ) ;
128
- #[ allow( clippy:: while_immutable_condition) ]
126
+ let mut guard = data. lock ( ) ;
129
127
while * guard != 10 {
130
- let _ = cv. wait ( & guard) ;
128
+ let _ = cv. wait ( & mut guard) ;
131
129
}
132
130
}
133
131
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