pub fn ack(&self) -> ZxResult {
        let mut inner = self.inner.lock();
        if inner.port.is_none() {
            return Err(ZxError::BAD_STATE);
        }
        if inner.state == InterruptState::Destroy {
            return Err(ZxError::CANCELED);
        }
        if inner.state == InterruptState::NeedAck {
            if self.flags.contains(InterruptFlags::UNMASK_PREWAIT) {
                self.trait_.unmask();
            } else if self.flags.contains(InterruptFlags::UNMASK_PREWAIT_UNLOCKED) {
                inner.defer_unmask = true;
            }
            if inner.timestamp > 0 {
                // TODO: use a function to send the package
                inner.packet_id = inner
                    .port
                    .as_ref()
                    .unwrap()
                    .as_ref()
                    .push_interrupt(inner.timestamp, inner.key);
                if self.flags.contains(InterruptFlags::MASK_POSTWAIT) {
                    self.trait_.mask();
                }
                inner.timestamp = 0;
            } else {
                inner.state = InterruptState::Idle;
            }
        }
        if inner.defer_unmask {
            self.trait_.unmask();
        }
        Ok(())
    }
/// Acknowledge the interrupt and re-arm it.
Acknowledge the interrupt and re-arm it.
Acknowledge the interrupt and re - arm it .
pub fn ack(&self) -> ZxResult {
        let mut inner = self.inner.lock();
        if inner.port.is_none() {
            return Err(ZxError::BAD_STATE);
        }
        if inner.state == InterruptState::Destroy {
            return Err(ZxError::CANCELED);
        }
        if inner.state == InterruptState::NeedAck {
            if self.flags.contains(InterruptFlags::UNMASK_PREWAIT) {
                self.trait_.unmask();
            } else if self.flags.contains(InterruptFlags::UNMASK_PREWAIT_UNLOCKED) {
                inner.defer_unmask = true;
            }
            if inner.timestamp > 0 {
                // TODO: use a function to send the package
                inner.packet_id = inner
                    .port
                    .as_ref()
                    .unwrap()
                    .as_ref()
                    .push_interrupt(inner.timestamp, inner.key);
                if self.flags.contains(InterruptFlags::MASK_POSTWAIT) {
                    self.trait_.mask();
                }
                inner.timestamp = 0;
            } else {
                inner.state = InterruptState::Idle;
            }
        }
        if inner.defer_unmask {
            self.trait_.unmask();
        }
        Ok(())
    }
pub fn ack ( & self ) -> ZxResult { let mut inner = self . inner . lock ( ) ; if inner . port . is_none ( ) { return Err ( ZxError :: BAD_STATE ) ; } if inner . state == InterruptState :: Destroy { return Err ( ZxError :: CANCELED ) ; } if inner . state == InterruptState :: NeedAck { if self . flags . contains ( InterruptFlags :: UNMASK_PREWAIT ) { self . trait_ . unmask ( ) ; } else if self . flags . contains ( InterruptFlags :: UNMASK_PREWAIT_UNLOCKED ) { inner . defer_unmask = true ; } if inner . timestamp > 0 { // TODO: use a function to send the package inner . packet_id = inner . port . as_ref ( ) . unwrap ( ) . as_ref ( ) . push_interrupt ( inner . timestamp , inner . key ) ; if self . flags . contains ( InterruptFlags :: MASK_POSTWAIT ) { self . trait_ . mask ( ) ; } inner . timestamp = 0 ; } else { inner . state = InterruptState :: Idle ; } } if inner . defer_unmask { self . trait_ . unmask ( ) ; } Ok ( ( ) ) }
Acknowledge the interrupt and re-arm it.
Acknowledge the interrupt and re - arm it .
&self
&self