diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-08-11 12:29:46 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-08-11 12:30:24 +0200 |
commit | 41709673f0165f16496ecf37162ed7dac06b5295 (patch) | |
tree | c213da683873bbe88927a3de58eb93f3f231a693 /messagebus | |
parent | 2fe073e8e1875bc891c38099c880d156bd228e9d (diff) |
Use std::atomic all over and completely get rid of homegrown atomics.
Diffstat (limited to 'messagebus')
3 files changed, 9 insertions, 12 deletions
diff --git a/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.cpp b/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.cpp index 3588e5aad40..55720f7d6ca 100644 --- a/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.cpp +++ b/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.cpp @@ -1,5 +1,4 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/util/atomic.h> #include "dynamicthrottlepolicy.h" #include "systemtimer.h" #include <climits> diff --git a/messagebus/src/vespa/messagebus/routing/routingnode.cpp b/messagebus/src/vespa/messagebus/routing/routingnode.cpp index 0f24b47cb94..62efda4aeb9 100644 --- a/messagebus/src/vespa/messagebus/routing/routingnode.cpp +++ b/messagebus/src/vespa/messagebus/routing/routingnode.cpp @@ -7,7 +7,6 @@ #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/tracelevel.h> -#include <vespa/vespalib/util/atomic.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/messagebus/network/inetwork.h> #include <stack> @@ -268,7 +267,7 @@ RoutingNode::notifySender() void RoutingNode::notifyMerge() { - if (vespalib::Atomic::postDec(&_pending) > 1) { + if (_pending.fetch_sub(1) > 1) { return; } diff --git a/messagebus/src/vespa/messagebus/routing/routingnode.h b/messagebus/src/vespa/messagebus/routing/routingnode.h index 32fa51881e3..22ff07c26e5 100644 --- a/messagebus/src/vespa/messagebus/routing/routingnode.h +++ b/messagebus/src/vespa/messagebus/routing/routingnode.h @@ -1,21 +1,20 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <map> +#include "iroutingpolicy.h" +#include "resender.h" +#include "route.h" +#include "routingcontext.h" +#include "routingnodeiterator.h" #include <vespa/messagebus/idiscardhandler.h> #include <vespa/messagebus/ireplyhandler.h> #include <vespa/messagebus/message.h> #include <vespa/messagebus/messagebus.h> #include <vespa/messagebus/network/iserviceaddress.h> #include <vespa/messagebus/reply.h> -#include <string> -#include <vector> #include <vespa/vespalib/util/sync.h> -#include "iroutingpolicy.h" -#include "resender.h" -#include "route.h" -#include "routingcontext.h" -#include "routingnodeiterator.h" +#include <vector> +#include <map> namespace mbus { @@ -40,7 +39,7 @@ private: IReplyHandler *_replyHandler; IDiscardHandler *_discardHandler; Trace _trace; - volatile uint32_t _pending; + std::atomic<uint32_t> _pending; Message &_msg; Reply::UP _reply; Route _route; |