aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-09-06 22:28:41 -0700
committermichael-west <michael.west@ettus.com>2017-12-19 17:18:33 -0800
commit57876913b0dfd0236d9805b705c5eb862051cd73 (patch)
tree03e32d144c14f09bb93de627545d8f61a1d0740d /host
parentf57484cdcec45ef2c0dd38fc864b38e3a461ef0a (diff)
downloaduhd-57876913b0dfd0236d9805b705c5eb862051cd73.tar.gz
uhd-57876913b0dfd0236d9805b705c5eb862051cd73.tar.bz2
uhd-57876913b0dfd0236d9805b705c5eb862051cd73.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 4f2ed8c65..fdb0321cf 100644
--- a/host/lib/usrp/usrp_c.cpp
+++ b/host/lib/usrp/usrp_c.cpp
@@ -324,10 +324,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;
}
@@ -346,10 +347,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;
}