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 /vespalib/src/tests/executor/threadstackexecutor_test.cpp | |
parent | 2fe073e8e1875bc891c38099c880d156bd228e9d (diff) |
Use std::atomic all over and completely get rid of homegrown atomics.
Diffstat (limited to 'vespalib/src/tests/executor/threadstackexecutor_test.cpp')
-rw-r--r-- | vespalib/src/tests/executor/threadstackexecutor_test.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/vespalib/src/tests/executor/threadstackexecutor_test.cpp b/vespalib/src/tests/executor/threadstackexecutor_test.cpp index cfdcd8ba79d..3e092ef145f 100644 --- a/vespalib/src/tests/executor/threadstackexecutor_test.cpp +++ b/vespalib/src/tests/executor/threadstackexecutor_test.cpp @@ -1,10 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/vespalib/util/atomic.h> #include <vespa/vespalib/util/threadstackexecutor.h> #include <vespa/vespalib/util/sync.h> #include <vespa/vespalib/util/backtrace.h> +#include <atomic> using namespace vespalib; @@ -13,24 +13,24 @@ typedef Executor::Task Task; struct MyTask : public Executor::Task { Gate &gate; CountDownLatch &latch; - static uint32_t runCnt; - static uint32_t deleteCnt; + static std::atomic<uint32_t> runCnt; + static std::atomic<uint32_t> deleteCnt; MyTask(Gate &g, CountDownLatch &l) : gate(g), latch(l) {} void run() override { - Atomic::postInc(&runCnt); + runCnt++; latch.countDown(); gate.await(); } ~MyTask() { - Atomic::postInc(&deleteCnt); + deleteCnt++; } static void resetStats() { runCnt = 0; deleteCnt = 0; } }; -uint32_t MyTask::runCnt = 0; -uint32_t MyTask::deleteCnt = 0; +std::atomic<uint32_t> MyTask::runCnt(0); +std::atomic<uint32_t> MyTask::deleteCnt(0); struct MyState { Gate gate; // to block workers |