Merge pull request #232 from mahkoh/jorth/fix-hc-tick
metal: prevent infinite loop in hardware-cursor update
This commit is contained in:
commit
6d769a15b4
2 changed files with 12 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue