pub fn sys_task_suspend_token(
        &self,
        handle: HandleValue,
        mut token: UserOutPtr<HandleValue>,
    ) -> ZxResult {
        info!("task.suspend_token: handle={:?}, token={:?}", handle, token);
        let proc = self.thread.proc();
        if let Ok(thread) = proc.get_object_with_rights::<Thread>(handle, Rights::WRITE) {
            if Arc::ptr_eq(&thread, self.thread) {
                return Err(ZxError::NOT_SUPPORTED);
            }
            if thread.state() == ThreadState::Dying || thread.state() == ThreadState::Dead {
                return Err(ZxError::BAD_STATE);
            }
            let thread: Arc<dyn Task> = thread;
            let token_handle =
                Handle::new(SuspendToken::create(&thread), Rights::DEFAULT_SUSPEND_TOKEN);
            token.write(proc.add_handle(token_handle))?;
            return Ok(());
        }
        if let Ok(_process) = proc.get_object_with_rights::<Process>(handle, Rights::WRITE) {
            return Err(ZxError::NOT_SUPPORTED);
        }
        Ok(())
    }
/// Suspend the given task.
///
/// > This function replaces task_suspend. When all callers are updated, `zx_task_suspend()` will be deleted and this function will be renamed ```zx_task_suspend()```.
Suspend the given task.
> This function replaces task_suspend.
Suspend the given task . > This function replaces task_suspend .
pub fn sys_task_suspend_token(
        &self,
        handle: HandleValue,
        mut token: UserOutPtr<HandleValue>,
    ) -> ZxResult {
        info!("task.suspend_token: handle={:?}, token={:?}", handle, token);
        let proc = self.thread.proc();
        if let Ok(thread) = proc.get_object_with_rights::<Thread>(handle, Rights::WRITE) {
            if Arc::ptr_eq(&thread, self.thread) {
                return Err(ZxError::NOT_SUPPORTED);
            }
            if thread.state() == ThreadState::Dying || thread.state() == ThreadState::Dead {
                return Err(ZxError::BAD_STATE);
            }
            let thread: Arc<dyn Task> = thread;
            let token_handle =
                Handle::new(SuspendToken::create(&thread), Rights::DEFAULT_SUSPEND_TOKEN);
            token.write(proc.add_handle(token_handle))?;
            return Ok(());
        }
        if let Ok(_process) = proc.get_object_with_rights::<Process>(handle, Rights::WRITE) {
            return Err(ZxError::NOT_SUPPORTED);
        }
        Ok(())
    }
pub fn sys_task_suspend_token ( & self , handle : HandleValue , mut token : UserOutPtr < HandleValue > , ) -> ZxResult { info ! ( " " handle token ) ; let proc = self . thread . proc ( ) ; if let Ok ( thread ) = proc . get_object_with_rights :: < Thread > ( handle , Rights :: WRITE ) { if Arc :: ptr_eq ( & thread , self . thread ) { return Err ( ZxError :: NOT_SUPPORTED ) ; } if thread . state ( ) == ThreadState :: Dying || thread . state ( ) == ThreadState :: Dead { return Err ( ZxError :: BAD_STATE ) ; } let thread : Arc < dyn Task > = thread ; let token_handle = Handle :: new ( SuspendToken :: create ( & thread ) , Rights :: DEFAULT_SUSPEND_TOKEN ) ; token . write ( proc . add_handle ( token_handle ) ) ? ; return Ok ( ( ) ) ; } if let Ok ( _process ) = proc . get_object_with_rights :: < Process > ( handle , Rights :: WRITE ) { return Err ( ZxError :: NOT_SUPPORTED ) ; } Ok ( ( ) ) }
Suspend the given task.
Suspend the given task .
&self
handle
HandleValue
token
UserOutPtr<HandleValue>
&self
handle
HandleValue
token
UserOutPtr<HandleValue>