namespace isc {
namespace netconf {
-bool NetconfProcess::shut_down = false;
+std::atomic<bool> NetconfProcess::shut_down(false);
NetconfProcess::NetconfProcess(const char* name,
const asiolink::IOServicePtr& io_service)
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <netconf/netconf.h>
#include <process/d_process.h>
#include <vector>
+#include <atomic>
namespace isc {
namespace netconf {
NetconfCfgMgrPtr getNetconfCfgMgr();
/// @brief Global (globally visible) shutdown flag.
- static bool shut_down;
+ static std::atomic<bool> shut_down;
private:
#include <gtest/gtest.h>
#include <sstream>
#include <thread>
+#include <atomic>
using namespace std;
using namespace isc;
}
// To know when the callback was called.
- static bool finished;
+ static atomic<bool> finished;
};
-bool TestCallback::finished = false;
+atomic<bool> TestCallback::finished(false);
/// Verifies the logChanges method handles correctly changes.
TEST_F(NetconfAgentLogTest, logChanges) {
#include <queue>
#include <thread>
#include <mutex>
-#include <boost/atomic.hpp>
+#include <atomic>
namespace isc {
namespace perfdhcp {
class Receiver {
private:
/// \brief Flag indicating if thread should run (true) or not (false).
- boost::atomic_flag run_flag_;
+ std::atomic_flag run_flag_;
/// \brief Thread for receiving packets.
std::unique_ptr<std::thread> recv_thread_;
socket_(socket),
single_threaded_(single_threaded),
ip_version_(ip_version) {
+ run_flag_.clear();
}
/// \brief Destructor.
-// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <exceptions/exceptions.h>
+#include <atomic>
+
namespace isc {
namespace asiolink {
// a function to call back when timer_ expires
IntervalTimer::Callback cbfunc_;
// interval in milliseconds
- long interval_;
+ std::atomic<long> interval_;
// asio timer
boost::asio::deadline_timer timer_;
IntervalTimerImpl::update() {
try {
// Update expire time to (current time + interval_).
- timer_.expires_from_now(boost::posix_time::millisec(interval_));
+ timer_.expires_from_now(boost::posix_time::millisec(long(interval_)));
// Reset timer.
// Pass a function bound with a shared_ptr to this.
timer_.async_wait(boost::bind(&IntervalTimerImpl::callback,
#include <exceptions/exceptions.h>
+#include <atomic>
+
namespace isc {
namespace process {
asiolink::IOServicePtr io_service_;
/// @brief Boolean flag set when shutdown has been requested.
- bool shut_down_flag_;
+ std::atomic<bool> shut_down_flag_;
/// @brief Pointer to the configuration manager.
DCfgMgrBasePtr cfg_mgr_;
#include <gtest/gtest.h>
#include <unistd.h>
+#include <atomic>
using namespace std;
using namespace isc;
/// @brief Counter used to track the number of passes made
/// within the thread worker function.
- int passes_;
+ std::atomic<int> passes_;
};
const int WatchedThreadTest::WORKER_MAX_PASSES = 10;