/// A helper function that ensures that if a resource is locked, it is unlocked.
A helper function that ensures that if a resource is locked, it is unlocked.
A helper function that ensures that if a resource is locked it is unlocked .
pub fn acquire<F, R>(&self, cxt: &Context, mut handler: F) -> Result<R, KernelError>
    where
        F: FnMut(&T) -> R,
    {
        // Context with priority zero is called during kernel initialization, so there is no locking happening here as such.
        if cxt.get_tid() == 0 {
            return Ok(handler(&self.inner));
        }
        let value = self.lock(cxt)?;
        let res = handler(value);
        self.unlock()?;
        return Ok(res);
    }
pub fn acquire < F , R > ( & self , cxt : & Context , mut handler : F ) -> Result < R , KernelError > where F : FnMut ( & T ) -> R , { // Context with priority zero is called during kernel initialization, so there is no locking happening here as such. if cxt . get_tid ( ) == 0 { return Ok ( handler ( & self . inner ) ) ; } let value = self . lock ( cxt ) ? ; let res = handler ( value ) ; self . unlock ( ) ? ; return Ok ( res ) ; }
A helper function that ensures that if a resource is locked, it is unlocked.
A helper function that ensures that if a resource is locked it is unlocked .
&self
cxt
&Context
handler
F