guard exception in classification_sample_async (#13530)
This commit is contained in:
parent
bea82ec92b
commit
0d4b331f84
@ -169,13 +169,13 @@ int main(int argc, char* argv[]) {
|
|||||||
std::exception_ptr exception_var;
|
std::exception_ptr exception_var;
|
||||||
// -------- Step 10. Do asynchronous inference --------
|
// -------- Step 10. Do asynchronous inference --------
|
||||||
infer_request.set_callback([&](std::exception_ptr ex) {
|
infer_request.set_callback([&](std::exception_ptr ex) {
|
||||||
|
std::lock_guard<std::mutex> l(mutex);
|
||||||
if (ex) {
|
if (ex) {
|
||||||
exception_var = ex;
|
exception_var = ex;
|
||||||
condVar.notify_all();
|
condVar.notify_all();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> l(mutex);
|
|
||||||
cur_iteration++;
|
cur_iteration++;
|
||||||
slog::info << "Completed " << cur_iteration << " async request execution" << slog::endl;
|
slog::info << "Completed " << cur_iteration << " async request execution" << slog::endl;
|
||||||
if (cur_iteration < num_iterations) {
|
if (cur_iteration < num_iterations) {
|
||||||
|
Loading…
Reference in New Issue
Block a user