error handle::exec(uint32_t addr, uint16_t flags) { std::unique_lock<std::recursive_mutex> lock(m_mutex); /* get a pointer so that it's not destroyed during the runtime of the function, * the pointer will be released at the end of the function */ std::shared_ptr<context> ctx = m_dev->get_context(); if(!ctx) return error::NO_CONTEXT; /* ensure valid status */ error err = status(); if(err != error::SUCCESS) return err; return exec_dev(addr, flags); }
error handle::exec_dev(uint32_t addr, uint16_t flags) { auto p = m_hwdev.lock(); return p ? p->exec_dev(addr, flags) : error::DISCONNECTED; }