mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
get rid of should_notify
as per [this comment][1] from @Darksonn, we should notify other workers any time we push to the LIFO slot, as it is stealable now. this simplifies the logic in `schedule_local` a bit, as we can get rid of the `should_notify` bool. [1]: https://github.com/tokio-rs/tokio/pull/7431#discussion_r2184724657
This commit is contained in:
parent
0889f08f27
commit
aff05a99f6
@ -1076,28 +1076,23 @@ impl Handle {
|
||||
// task must always be pushed to the back of the queue, enabling other
|
||||
// tasks to be executed. If **not** a yield, then there is more
|
||||
// flexibility and the task may go to the front of the queue.
|
||||
let should_notify = if is_yield || !core.lifo_enabled {
|
||||
if is_yield || !core.lifo_enabled {
|
||||
core.run_queue
|
||||
.push_back_or_overflow(task, self, &mut core.stats);
|
||||
true
|
||||
} else {
|
||||
// Push to the LIFO slot
|
||||
match core.run_queue.push_lifo(task) {
|
||||
Some(prev) => {
|
||||
// There was a previous task in the LIFO slot which needs
|
||||
// to be pushed to the back of the run queue.
|
||||
core.run_queue
|
||||
.push_back_or_overflow(prev, self, &mut core.stats);
|
||||
true
|
||||
}
|
||||
None => false,
|
||||
if let Some(prev) = core.run_queue.push_lifo(task) {
|
||||
// There was a previous task in the LIFO slot which needs
|
||||
// to be pushed to the back of the run queue.
|
||||
core.run_queue
|
||||
.push_back_or_overflow(prev, self, &mut core.stats);
|
||||
}
|
||||
};
|
||||
|
||||
// Only notify if not currently parked. If `park` is `None`, then the
|
||||
// scheduling is from a resource driver. As notifications often come in
|
||||
// batches, the notification is delayed until the park is complete.
|
||||
if should_notify && core.park.is_some() {
|
||||
if core.park.is_some() {
|
||||
self.notify_parked_local();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user