diff options
author | Josh Blum <josh@joshknows.com> | 2012-10-29 17:39:32 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-10-29 17:41:05 -0700 |
commit | e3452bf969552abf2497dbd7ac8ed093a3f36de3 (patch) | |
tree | 742eb9cc5aaa66ef5772eb35fa885fdb57848770 /host/include | |
parent | cd8a998b2f7249916424b969b0aa75489291152b (diff) | |
download | uhd-e3452bf969552abf2497dbd7ac8ed093a3f36de3.tar.gz uhd-e3452bf969552abf2497dbd7ac8ed093a3f36de3.tar.bz2 uhd-e3452bf969552abf2497dbd7ac8ed093a3f36de3.zip |
uhd: added barrier interrupt to work around thread issue
Force the barrier wait to throw a boost::thread_interrupted
The threads were not getting the interruption_point on windows.
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/utils/atomic.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/host/include/uhd/utils/atomic.hpp b/host/include/uhd/utils/atomic.hpp index dc1790c3f..7a81d8d5e 100644 --- a/host/include/uhd/utils/atomic.hpp +++ b/host/include/uhd/utils/atomic.hpp @@ -82,12 +82,23 @@ namespace uhd{ _count.write(size); } + /*! + * Force the barrier wait to throw a boost::thread_interrupted + * The threads were not getting the interruption_point on windows. + */ + void interrupt(void) + { + _count.write(boost::uint32_t(~0)); + } + //! Wait on the barrier condition UHD_INLINE void wait(void){ _count.dec(); _count.cas(_size, 0); while (_count.read() != _size){ boost::this_thread::interruption_point(); + if (_count.read() == boost::uint32_t(~0)) + throw boost::thread_interrupted(); boost::this_thread::yield(); } } |