diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/common/recv_packet_demuxer_3000.hpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/host/lib/usrp/common/recv_packet_demuxer_3000.hpp b/host/lib/usrp/common/recv_packet_demuxer_3000.hpp index 4fb6c4604..77bdebab0 100644 --- a/host/lib/usrp/common/recv_packet_demuxer_3000.hpp +++ b/host/lib/usrp/common/recv_packet_demuxer_3000.hpp @@ -70,7 +70,10 @@ namespace uhd{ namespace usrp{ return buff; } } - + // Following is disabled by default as super_recv_packet_handler (caller) is not thread safe + // Only underlying transport (libusb1_zero_copy) is thread safe + // The onus is on the caller to super_recv_packet_handler (and therefore this) to serialise access +#ifdef RECV_PACKET_DEMUXER_3000_THREAD_SAFE //---------------------------------------------------------- //-- Try to claim the transport or wait patiently //---------------------------------------------------------- @@ -84,6 +87,7 @@ namespace uhd{ namespace usrp{ //-- Wait on the transport for input buffers //---------------------------------------------------------- else +#endif // RECV_PACKET_DEMUXER_3000_THREAD_SAFE { buff = _xport->get_recv_buff(timeout); if (buff) @@ -99,8 +103,10 @@ namespace uhd{ namespace usrp{ buff.reset(); } } +#ifdef RECV_PACKET_DEMUXER_3000_THREAD_SAFE _claimed.write(0); cond.notify_all(); +#endif // RECV_PACKET_DEMUXER_3000_THREAD_SAFE } return buff; } @@ -117,8 +123,10 @@ namespace uhd{ namespace usrp{ typedef std::queue<transport::managed_recv_buffer::sptr> queue_type_t; std::map<boost::uint32_t, queue_type_t> _queues; transport::zero_copy_if::sptr _xport; +#ifdef RECV_PACKET_DEMUXER_3000_THREAD_SAFE uhd::atomic_uint32_t _claimed; boost::condition_variable cond; +#endif // RECV_PACKET_DEMUXER_3000_THREAD_SAFE boost::mutex mutex; }; |