From 7431627a2a64735f958bb2ced028fd73bbd8bb68 Mon Sep 17 00:00:00 2001 From: Balint Seeber Date: Mon, 3 Feb 2014 11:15:44 -0800 Subject: uhd: disabled atomic 'claim' check for multi-threaded access to recv_packet_demuxer_3000 The only caller is from super_packet_recv_handler, which is already not thread-safe. The only underlying transport (libusb1_zero_copy) is thread-safe, so this shouldn't have an impact. This solves the issue where (e.g. from GNU Radio), 'interrupt' is called on the worker thread while waiting for a join when worker thread is torn down (e.g. GR top block stop/wait/start), which would cause the demuxer to still think the transport was claimed, as an interrupted exception will be thrown in 'wait_for_completion' in the transport, and execution will not continue back into the demuxer to mark the transport as un-claimed, so future 'recv' streamer calls will always fail since the demux thinks the transport is still claimed from before. --- host/lib/usrp/common/recv_packet_demuxer_3000.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'host/lib/usrp/common') diff --git a/host/lib/usrp/common/recv_packet_demuxer_3000.hpp b/host/lib/usrp/common/recv_packet_demuxer_3000.hpp index 4fb6c4604..543c9ce76 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) -- cgit v1.2.3