aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBalint Seeber <balint@ettus.com>2014-02-03 11:15:44 -0800
committerBalint Seeber <balint@ettus.com>2014-02-03 11:15:44 -0800
commit7431627a2a64735f958bb2ced028fd73bbd8bb68 (patch)
tree559d570b163b7281d1093e4db22056c77a61f32b
parent3edead271655316826864ebb8a0d9d529402f31f (diff)
downloaduhd-7431627a2a64735f958bb2ced028fd73bbd8bb68.tar.gz
uhd-7431627a2a64735f958bb2ced028fd73bbd8bb68.tar.bz2
uhd-7431627a2a64735f958bb2ced028fd73bbd8bb68.zip
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.
-rw-r--r--host/lib/usrp/common/recv_packet_demuxer_3000.hpp6
1 files changed, 5 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..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)