Skip to content

Commit

Permalink
Merge pull request #232 from mahkoh/jorth/fix-hc-tick
Browse files Browse the repository at this point in the history
metal: prevent infinite loop in hardware-cursor update
  • Loading branch information
mahkoh authored Jul 23, 2024
2 parents a252812 + 8227d3c commit 6d769a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tasks/hardware_cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ pub async fn handle_hardware_cursor_tick(state: Rc<State>) {
log::error!("Could not wait for cursor tick: {}", ErrorFmt(e));
break;
}
} else {
if state.hardware_tick_cursor.is_not_empty() {
break;
}
}
state.refresh_hardware_cursors();
}
Expand Down
8 changes: 8 additions & 0 deletions src/utils/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ impl<T> AsyncQueue<T> {
AsyncQueueNonEmpty { queue: self }
}

pub fn is_empty(&self) -> bool {
unsafe { self.data.get().deref().is_empty() }
}

pub fn is_not_empty(&self) -> bool {
!self.is_empty()
}

pub fn clear(&self) {
unsafe {
mem::take(self.data.get().deref_mut());
Expand Down

0 comments on commit 6d769a1

Please sign in to comment.