mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 14:17:02 +00:00
Rename both PlatformDispatcher::poll and Executor::run_step to 'tick'
Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
17b2b112bc
commit
f3b6719c76
5 changed files with 8 additions and 8 deletions
|
@ -359,7 +359,7 @@ impl<T: Send> Model<T> {
|
|||
Ok(Some(event)) => return event,
|
||||
Ok(None) => panic!("model was dropped"),
|
||||
Err(_) => {
|
||||
if !cx.executor().run_step() {
|
||||
if !cx.executor().tick() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ impl BackgroundExecutor {
|
|||
match future.as_mut().poll(&mut cx) {
|
||||
Poll::Ready(result) => return result,
|
||||
Poll::Pending => {
|
||||
if !self.dispatcher.poll(background_only) {
|
||||
if !self.dispatcher.tick(background_only) {
|
||||
if awoken.swap(false, SeqCst) {
|
||||
continue;
|
||||
}
|
||||
|
@ -255,8 +255,8 @@ impl BackgroundExecutor {
|
|||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn run_step(&self) -> bool {
|
||||
self.dispatcher.as_test().unwrap().poll(false)
|
||||
pub fn tick(&self) -> bool {
|
||||
self.dispatcher.as_test().unwrap().tick(false)
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
|
|
|
@ -165,7 +165,7 @@ pub trait PlatformDispatcher: Send + Sync {
|
|||
fn dispatch(&self, runnable: Runnable, label: Option<TaskLabel>);
|
||||
fn dispatch_on_main_thread(&self, runnable: Runnable);
|
||||
fn dispatch_after(&self, duration: Duration, runnable: Runnable);
|
||||
fn poll(&self, background_only: bool) -> bool;
|
||||
fn tick(&self, background_only: bool) -> bool;
|
||||
fn park(&self);
|
||||
fn unparker(&self) -> Unparker;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ impl PlatformDispatcher for MacDispatcher {
|
|||
}
|
||||
}
|
||||
|
||||
fn poll(&self, _background_only: bool) -> bool {
|
||||
fn tick(&self, _background_only: bool) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ impl TestDispatcher {
|
|||
}
|
||||
|
||||
pub fn run_until_parked(&self) {
|
||||
while self.poll(false) {}
|
||||
while self.tick(false) {}
|
||||
}
|
||||
|
||||
pub fn parking_allowed(&self) -> bool {
|
||||
|
@ -194,7 +194,7 @@ impl PlatformDispatcher for TestDispatcher {
|
|||
state.delayed.insert(ix, (next_time, runnable));
|
||||
}
|
||||
|
||||
fn poll(&self, background_only: bool) -> bool {
|
||||
fn tick(&self, background_only: bool) -> bool {
|
||||
let mut state = self.state.lock();
|
||||
|
||||
while let Some((deadline, _)) = state.delayed.first() {
|
||||
|
|
Loading…
Reference in a new issue