From: Wolfgang Bangerth Date: Sun, 5 Dec 2021 22:55:49 +0000 (-0700) Subject: Move a check out of an inner loop. X-Git-Tag: v9.3.3~5^2~12 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7619fd05501a8cba7569bccf6c894dde6cd7e54e;p=dealii.git Move a check out of an inner loop. --- diff --git a/include/deal.II/base/work_stream.h b/include/deal.II/base/work_stream.h index 1349f60115..b36f7a4248 100644 --- a/include/deal.II/base/work_stream.h +++ b/include/deal.II/base/work_stream.h @@ -655,26 +655,27 @@ namespace WorkStream tbb::filter::serial, [copier = std::function(copier)]( ItemType *¤t_item) { - // Initiate copying data. For the same reasons as in the worker - // class above, catch exceptions rather than letting them propagate - // into unknown territories: - for (unsigned int i = 0; i < current_item->n_items; ++i) + if (copier) { - try + // Initiate copying data. For the same reasons as in the worker + // class above, catch exceptions rather than letting them + // propagate into unknown territories: + for (unsigned int i = 0; i < current_item->n_items; ++i) { - if (copier) - copier(current_item->copy_datas[i]); - } - catch (const std::exception &exc) - { - Threads::internal::handle_std_exception(exc); - } - catch (...) - { - Threads::internal::handle_unknown_exception(); + try + { + copier(current_item->copy_datas[i]); + } + catch (const std::exception &exc) + { + Threads::internal::handle_std_exception(exc); + } + catch (...) + { + Threads::internal::handle_unknown_exception(); + } } } - // mark current item as usable again current_item->currently_in_use = false; });