aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-09-06 22:28:41 -0700
committerMartin Braun <martin.braun@ettus.com>2017-09-28 17:50:23 -0700
commit59736a5bf512db83a6bd7250e14b13c7464770fc (patch)
tree46b73dc4da9a6a98135e40071f3be8b33db05b5b /host
parentcd30ecf6e2fd3197d75ca82045c473c98be6889e (diff)
downloaduhd-59736a5bf512db83a6bd7250e14b13c7464770fc.tar.gz
uhd-59736a5bf512db83a6bd7250e14b13c7464770fc.tar.bz2
uhd-59736a5bf512db83a6bd7250e14b13c7464770fc.zip
C API: Better error handling in uhd_usrp_get_?x_stream
In uhd_usrp_get_rx_stream and uhd_usrp_get_tx_stream, an error will now be propagated into the streamer handle.
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/usrp_c.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/host/lib/usrp/usrp_c.cpp b/host/lib/usrp/usrp_c.cpp
index 5536c7946..13b4b607b 100644
--- a/host/lib/usrp/usrp_c.cpp
+++ b/host/lib/usrp/usrp_c.cpp
@@ -323,10 +323,11 @@ uhd_error uhd_usrp_get_rx_stream(
uhd_stream_args_t *stream_args,
uhd_rx_streamer_handle h_s
){
- UHD_SAFE_C(
+ UHD_SAFE_C_SAVE_ERROR(h_s,
boost::mutex::scoped_lock lock(_usrp_get_rx_stream_mutex);
if(!get_usrp_ptrs().count(h_u->usrp_index)){
+ h_s->last_error = "Streamer's device is invalid or expired.";
return UHD_ERROR_INVALID_DEVICE;
}
@@ -345,10 +346,11 @@ uhd_error uhd_usrp_get_tx_stream(
uhd_stream_args_t *stream_args,
uhd_tx_streamer_handle h_s
){
- UHD_SAFE_C(
+ UHD_SAFE_C_SAVE_ERROR(h_s,
boost::mutex::scoped_lock lock(_usrp_get_tx_stream_mutex);
if(!get_usrp_ptrs().count(h_u->usrp_index)){
+ h_s->last_error = "Streamer's device is invalid or expired.";
return UHD_ERROR_INVALID_DEVICE;
}