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.4.0-rc1~769^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=270a58d91ab02c688d27a5f986c258b12cbde760;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 1977efda23..882ca45562 100644 --- a/include/deal.II/base/work_stream.h +++ b/include/deal.II/base/work_stream.h @@ -651,26 +651,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; });