diff options
author | Martin Braun <martin.braun@ettus.com> | 2016-09-28 15:50:53 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2016-09-28 15:50:53 -0700 |
commit | 811444b126ed40aed115af4464422122afd0c607 (patch) | |
tree | 66302b72a71376bfed4e8f988ee057cb1e705434 /host/include | |
parent | 0d28752da7dd4a25a890caef0fad3cadd5742655 (diff) | |
download | uhd-811444b126ed40aed115af4464422122afd0c607.tar.gz uhd-811444b126ed40aed115af4464422122afd0c607.tar.bz2 uhd-811444b126ed40aed115af4464422122afd0c607.zip |
atomic: Removed reusable_barrier
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/utils/atomic.hpp | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/host/include/uhd/utils/atomic.hpp b/host/include/uhd/utils/atomic.hpp index 8c5e6a5da..8da71b359 100644 --- a/host/include/uhd/utils/atomic.hpp +++ b/host/include/uhd/utils/atomic.hpp @@ -68,76 +68,6 @@ namespace uhd{ }; /*! - * A reusable barrier to sync multiple threads. - * All threads spin on wait() until count is reset. - */ - class UHD_API reusable_barrier{ - public: - - reusable_barrier():_size (0) {} - - reusable_barrier(const size_t size):_size(size) {} - - //! Resize the barrier for N threads - void resize(const size_t size){ - _size = size; - } - - /*! - * Force the barrier wait to throw a boost::thread_interrupted - * The threads were not getting the interruption_point on windows. - */ - void interrupt(void) - { - _done.inc(); - } - - //! Wait on the barrier condition - UHD_INLINE void wait(void) - { - if (_size == 1) return; - - //entry barrier with condition variable - _entry_counter.inc(); - _entry_counter.cas(0, _size); - boost::mutex::scoped_lock lock(_mutex); - while (_entry_counter.read() != 0) - { - this->check_interrupt(); - _cond.timed_wait(lock, boost::posix_time::milliseconds(1)); - } - lock.unlock(); //unlock before notify - _cond.notify_one(); - - //exit barrier to ensure known condition of entry count - _exit_counter.inc(); - _exit_counter.cas(0, _size); - while (_exit_counter.read() != 0) this->check_interrupt(); - } - - //! Wait on the barrier condition - UHD_INLINE void wait_others(void) - { - while (_entry_counter.read() != (_size-1)) this->check_interrupt(); - } - - private: - size_t _size; - atomic_uint32_t _entry_counter; - atomic_uint32_t _exit_counter; - atomic_uint32_t _done; - boost::mutex _mutex; - boost::condition_variable _cond; - - UHD_INLINE void check_interrupt(void) - { - if (_done.read() != 0) throw boost::thread_interrupted(); - boost::this_thread::interruption_point(); - boost::this_thread::yield(); - } - }; - - /*! * Spin-wait on a condition with a timeout. * \param cond an atomic variable to compare * \param value compare to atomic for true/false |