From: Jean-Paul Pelteret Date: Mon, 30 Apr 2018 20:48:31 +0000 (+0200) Subject: Remove debug mode guards in Subscriptor::(un)subscribe. X-Git-Tag: v9.1.0-rc1~873^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=123e51782f6115758721cccb455ff1c9dbe23b2b;p=dealii.git Remove debug mode guards in Subscriptor::(un)subscribe. The aim here is to prevent a race conditions not appearing in debug mode and but only in release mode (which would actually mak debugging harder). The drawback is that in release mode subscription, which does not occur too frequently, is now more expensive. --- diff --git a/source/base/subscriptor.cc b/source/base/subscriptor.cc index 9a6b95ebc1..a02237ee48 100644 --- a/source/base/subscriptor.cc +++ b/source/base/subscriptor.cc @@ -156,7 +156,6 @@ Subscriptor::operator=(Subscriptor &&s) noexcept void Subscriptor::subscribe(const char *id) const { -#ifdef DEBUG if (object_info == nullptr) object_info = &typeid(*this); ++counter; @@ -173,16 +172,12 @@ Subscriptor::subscribe(const char *id) const else it->second++; -#else - (void)id; -#endif } void Subscriptor::unsubscribe(const char *id) const { -#ifdef DEBUG const char *name = (id != nullptr) ? id : unknown_subscriber; AssertNothrow(counter > 0, ExcNoSubscriber(object_info->name(), name)); // This is for the case that we do @@ -202,9 +197,6 @@ Subscriptor::unsubscribe(const char *id) const AssertNothrow(it->second > 0, ExcNoSubscriber(object_info->name(), name)); it->second--; -#else - (void)id; -#endif }