From 347bb79d2adef4b5bf3e3a94577ecc18c0408519 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 24 Aug 2017 14:37:08 -0700 Subject: uhd: Removed atomic.hpp from public API atomic.hpp defines a spin lock and a lockfree mutex. There is no reason to have standard constructs in the public API, where we're contractually obligated to not touch them. Thus, moving them into the internal API space. --- host/include/uhd/utils/CMakeLists.txt | 1 - host/include/uhd/utils/atomic.hpp | 73 ----------------------------------- 2 files changed, 74 deletions(-) delete mode 100644 host/include/uhd/utils/atomic.hpp (limited to 'host/include') diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt index 85afc09bb..9c2fed964 100644 --- a/host/include/uhd/utils/CMakeLists.txt +++ b/host/include/uhd/utils/CMakeLists.txt @@ -9,7 +9,6 @@ UHD_INSTALL(FILES algorithm.hpp assert_has.hpp assert_has.ipp - atomic.hpp byteswap.hpp byteswap.ipp cast.hpp diff --git a/host/include/uhd/utils/atomic.hpp b/host/include/uhd/utils/atomic.hpp deleted file mode 100644 index 4be416a30..000000000 --- a/host/include/uhd/utils/atomic.hpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright 2012-2013,2016-2017 Ettus Research LLC -// Copyright 2018 Ettus Research, a National Instruments Company -// -// SPDX-License-Identifier: GPL-3.0-or-later -// - -#ifndef INCLUDED_UHD_UTILS_ATOMIC_HPP -#define INCLUDED_UHD_UTILS_ATOMIC_HPP - -#include -#include -#include -#include - -namespace uhd{ - - /*! DEPRECATED -- Will be removed in coming versions of UHD. - * - * Spin-wait on a condition with a timeout. - * \param cond an atomic variable to compare - * \param value compare to atomic for true/false - * \param timeout the timeout in seconds - * \return true for cond == value, false for timeout - */ - template - UHD_INLINE bool spin_wait_with_timeout( - std::atomic &cond, - const T value, - const double timeout - ){ - if (cond == value) return true; - const time_spec_t exit_time = time_spec_t::get_system_time() + time_spec_t(timeout); - while (cond != value) { - if (time_spec_t::get_system_time() > exit_time) { - return false; - } - boost::this_thread::interruption_point(); - boost::this_thread::yield(); - } - return true; - } - - /*! DEPRECATED -- Will be removed in coming versions of UHD. - * - * Claimer class to provide synchronization for multi-thread access. - * Claiming enables buffer classes to be used with a buffer queue. - */ - class simple_claimer{ - public: - simple_claimer(void){ - this->release(); - } - - UHD_INLINE void release(void){ - _locked = false; - } - - UHD_INLINE bool claim_with_wait(const double timeout){ - if (spin_wait_with_timeout(_locked, false, timeout)){ - _locked = true; - return true; - } - return false; - } - - private: - std::atomic _locked; - }; - -} //namespace uhd - -#endif /* INCLUDED_UHD_UTILS_ATOMIC_HPP */ -- cgit v1.2.3