Simplified cancel behavior (#4224)

This commit is contained in:
Anton Pankratv
2021-02-09 12:55:24 +03:00
committed by GitHub
parent 751ac1aef4
commit 91dcb515a3
14 changed files with 42 additions and 83 deletions

View File

@@ -162,10 +162,13 @@ public:
CALL_STATUS_FNC_NO_ARGS(Infer);
}
StatusCode Cancel() {
ResponseDesc resp;
if (actual == nullptr) THROW_IE_EXCEPTION << "InferRequest was not initialized.";
return actual->Cancel(&resp);
/**
* @copybrief IInferRequest::Cancel
*
* Wraps IInferRequest::Cancel
*/
void Cancel() {
CALL_STATUS_FNC_NO_ARGS(Cancel);
}
/**

View File

@@ -60,6 +60,8 @@ inline void extract_exception(StatusCode status, const char* msg) {
throw InferNotStarted(msg);
case NETWORK_NOT_READ:
throw NetworkNotRead(msg);
case INFER_CANCELLED:
throw InferCancelled(msg);
default:
THROW_IE_EXCEPTION << msg << InferenceEngine::details::as_status << status;
}

View File

@@ -334,6 +334,11 @@ class NetworkNotRead : public std::logic_error {
using std::logic_error::logic_error;
};
/** @brief This class represents StatusCode::INFER_CANCELLED exception */
class InferCancelled : public std::logic_error {
using std::logic_error::logic_error;
};
} // namespace InferenceEngine
#if defined(_WIN32)