summaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
authorMichael West <michael.west@ettus.com>2013-11-20 12:14:24 -0800
committerMichael West <michael.west@ettus.com>2013-11-20 12:14:24 -0800
commit6ff935e6955be81f30606d0444a265ea03dc6f5d (patch)
tree27745786f543858b99d22de1d87f87da9f905f15 /host/examples
parent1fe3db82d6d292a186fe26e728dfdf68db4db056 (diff)
parent265e94473130ffefc95d4eb67e8d46ce50982be4 (diff)
downloaduhd-6ff935e6955be81f30606d0444a265ea03dc6f5d.tar.gz
uhd-6ff935e6955be81f30606d0444a265ea03dc6f5d.tar.bz2
uhd-6ff935e6955be81f30606d0444a265ea03dc6f5d.zip
Merge remote branch
Diffstat (limited to 'host/examples')
-rw-r--r--host/examples/network_relay.cpp15
-rw-r--r--host/examples/test_dboard_coercion.cpp4
-rw-r--r--host/examples/test_messages.cpp5
3 files changed, 12 insertions, 12 deletions
diff --git a/host/examples/network_relay.cpp b/host/examples/network_relay.cpp
index a12c38ff8..fc1ebd91d 100644
--- a/host/examples/network_relay.cpp
+++ b/host/examples/network_relay.cpp
@@ -33,9 +33,6 @@ typedef boost::shared_ptr<asio::ip::udp::socket> socket_type;
static const size_t insane_mtu = 9000;
-boost::mutex spawn_mutex;
-boost::condition_variable thread_spawned;
-
#if defined(UHD_PLATFORM_MACOS)
//limit buffer resize on macos or it will error
const size_t rx_dsp_buff_size = size_t(1e6);
@@ -101,11 +98,11 @@ public:
}
std::cout << "spawning relay threads... " << _port << std::endl;
- boost::unique_lock<boost::mutex> lock(spawn_mutex);
+ boost::unique_lock<boost::mutex> lock(spawn_mutex); // lock in preparation to wait for threads to spawn
_thread_group.create_thread(boost::bind(&udp_relay_type::server_thread, this));
- thread_spawned.wait(lock);
+ wait_for_thread.wait(lock); // wait for thread to spin up
_thread_group.create_thread(boost::bind(&udp_relay_type::client_thread, this));
- thread_spawned.wait(lock);
+ wait_for_thread.wait(lock); // wait for thread to spin up
std::cout << " done!" << std::endl << std::endl;
}
@@ -126,7 +123,7 @@ private:
void server_thread(void){
uhd::set_thread_priority_safe();
std::cout << " entering server_thread..." << std::endl;
- thread_spawned.notify_one();
+ wait_for_thread.notify_one(); // notify constructor that this thread has started
std::vector<char> buff(insane_mtu);
while (not boost::this_thread::interruption_requested()){
if (wait_for_recv_ready(_server_socket->native())){
@@ -152,7 +149,7 @@ private:
void client_thread(void){
uhd::set_thread_priority_safe();
std::cout << " entering client_thread..." << std::endl;
- thread_spawned.notify_one();
+ wait_for_thread.notify_one(); // notify constructor that this thread has started
std::vector<char> buff(insane_mtu);
while (not boost::this_thread::interruption_requested()){
if (wait_for_recv_ready(_client_socket->native())){
@@ -170,6 +167,8 @@ private:
asio::ip::udp::endpoint _endpoint;
boost::mutex _endpoint_mutex;
socket_type _server_socket, _client_socket;
+ boost::mutex spawn_mutex;
+ boost::condition_variable wait_for_thread;
};
diff --git a/host/examples/test_dboard_coercion.cpp b/host/examples/test_dboard_coercion.cpp
index bbe6f70dd..86c59d9d7 100644
--- a/host/examples/test_dboard_coercion.cpp
+++ b/host/examples/test_dboard_coercion.cpp
@@ -121,7 +121,7 @@ std::string tx_test(uhd::usrp::multi_usrp::sptr usrp, bool test_gain, bool verbo
gains.push_back(current_gain);
current_gain++;
}
- if(gain_end != gains.back()) gains.push_back(gain_end);
+ gains.push_back(gain_end);
}
@@ -313,7 +313,7 @@ std::string rx_test(uhd::usrp::multi_usrp::sptr usrp, bool test_gain, bool verbo
gains.push_back(current_gain);
current_gain++;
}
- if(gain_end != gains.back()) gains.push_back(gain_end);
+ gains.push_back(gain_end);
}
diff --git a/host/examples/test_messages.cpp b/host/examples/test_messages.cpp
index 0815d0b1c..4240e830b 100644
--- a/host/examples/test_messages.cpp
+++ b/host/examples/test_messages.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2011 Ettus Research LLC
+// Copyright 2010-2013 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
+#include <uhd/config.hpp>
#include <uhd/utils/thread_priority.hpp>
#include <uhd/utils/safe_main.hpp>
#include <uhd/utils/static.hpp>
@@ -84,7 +85,7 @@ bool test_late_command_message(uhd::usrp::multi_usrp::sptr usrp, uhd::rx_streame
* Issue a stream command with num samps and more.
* We expect to get an inline broken chain message.
*/
-bool test_broken_chain_message(uhd::usrp::multi_usrp::sptr usrp __attribute__ ((unused)), uhd::rx_streamer::sptr rx_stream, uhd::tx_streamer::sptr){
+bool test_broken_chain_message(UHD_UNUSED(uhd::usrp::multi_usrp::sptr usrp), uhd::rx_streamer::sptr rx_stream, uhd::tx_streamer::sptr){
std::cout << "Test broken chain message... " << std::flush;
uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_MORE);