Skip to content

Commit 8e62a54

Browse files
committed
using try_lock instead of lock
- offers the option for a nested call of block_on
1 parent 8587bd1 commit 8e62a54

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/executor/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,18 @@ where
169169
{
170170
if let Some(mut guard) = crate::executor::network::NIC.try_lock() {
171171
let delay = if let Ok(nic) = guard.as_nic_mut() {
172+
nic.set_polling_mode(false);
173+
172174
nic.poll_delay(Instant::from_micros_const(now.try_into().unwrap()))
173175
.map(|d| d.total_micros())
174176
} else {
175177
None
176178
};
179+
177180
core_local::core_scheduler().add_network_timer(
178181
delay.map(|d| crate::arch::processor::get_timer_ticks() + d),
179182
);
180183
}
181-
182-
if let Ok(device) = crate::executor::network::NIC.lock().as_nic_mut() {
183-
device.set_polling_mode(false);
184-
}
185184
}
186185

187186
return t;

0 commit comments

Comments
 (0)