libcamera: ipa_proxy: Allow stop() on a stopped IPA

To make error handling easier in callers, allow the stop() function to
be called when the proxy is already stopped, or not started yet.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart
2020-07-06 13:59:19 +03:00
parent 2c0fad508c
commit 49771c6dcc
3 changed files with 15 additions and 0 deletions

View File

@@ -27,6 +27,8 @@ public:
std::string configurationFile(const std::string &file) const;
void stop() override = 0;
protected:
std::string resolvePath(const std::string &file) const;

View File

@@ -145,6 +145,16 @@ std::string IPAProxy::configurationFile(const std::string &name) const
return std::string();
}
/**
* \fn IPAProxy::stop()
* \brief Stop the IPA proxy
*
* This function stops the IPA and releases all the resources acquired by the
* proxy in start(). Calling stop() when the IPA proxy hasn't been started or
* has already been stopped is valid, the proxy shall treat this as a no-op and
* shall not forward the call to the IPA.
*/
/**
* \brief Find a valid full path for a proxy worker for a given executable name
* \param[in] file File name of proxy worker executable

View File

@@ -121,6 +121,9 @@ int IPAProxyThread::start()
void IPAProxyThread::stop()
{
if (!running_)
return;
running_ = false;
proxy_.invokeMethod(&ThreadProxy::stop, ConnectionTypeBlocking);