error handle::get_log(void *buf, size_t& buf_sz) { 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 get_dev_log(buf, buf_sz); }
error handle::get_dev_log(void *buf, size_t& buf_sz) { auto p = m_hwdev.lock(); return p ? p->get_dev_log(buf, buf_sz) : error::DISCONNECTED; }