diff options
author | Ciro Nishiguchi <ciro.nishiguchi@ni.com> | 2019-10-26 18:40:01 -0500 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 12:21:33 -0800 |
commit | 10b9d2688b5bcb150eec786a9ef7473f1c1c28ac (patch) | |
tree | 17f45cc4c8d56bba84a6a54a0f6568703fe03e1e /host/lib/transport/offload_io_service.cpp | |
parent | 98a510d68e12751917dba29522c69de9964decf6 (diff) | |
download | uhd-10b9d2688b5bcb150eec786a9ef7473f1c1c28ac.tar.gz uhd-10b9d2688b5bcb150eec786a9ef7473f1c1c28ac.tar.bz2 uhd-10b9d2688b5bcb150eec786a9ef7473f1c1c28ac.zip |
rfnoc: Make I/O services relinquish CPU while waiting
Diffstat (limited to 'host/lib/transport/offload_io_service.cpp')
-rw-r--r-- | host/lib/transport/offload_io_service.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/host/lib/transport/offload_io_service.cpp b/host/lib/transport/offload_io_service.cpp index c9b9af344..53c8f017d 100644 --- a/host/lib/transport/offload_io_service.cpp +++ b/host/lib/transport/offload_io_service.cpp @@ -24,7 +24,7 @@ namespace uhd { namespace transport { namespace { -constexpr int32_t blocking_timeout_ms = 100; +constexpr int32_t blocking_timeout_ms = 10; // Fixed-size queue that supports blocking semantics template <typename queue_item_t> @@ -108,6 +108,13 @@ public: return queue_element.buff; } + frame_buff* client_pop(int32_t timeout_ms) + { + from_offload_thread_t queue_element; + _from_offload_thread.pop(queue_element, timeout_ms); + return queue_element.buff; + } + size_t client_read_available() { return _from_offload_thread.read_available(); @@ -474,8 +481,13 @@ recv_io_if::sptr offload_io_service_impl::make_recv_client(recv_link_if::sptr re port->client_wait_until_connected(); // Return a new recv client to the caller that just operates on the queues - return std::make_shared<offload_recv_io<offload_io_service_impl>>( - shared_from_this(), num_recv_frames, num_send_frames, port); + if (_offload_thread_params.wait_mode == POLL) { + return std::make_shared<offload_recv_io<offload_io_service_impl, true>>( + shared_from_this(), num_recv_frames, num_send_frames, port); + } else { + return std::make_shared<offload_recv_io<offload_io_service_impl, false>>( + shared_from_this(), num_recv_frames, num_send_frames, port); + } } send_io_if::sptr offload_io_service_impl::make_send_client(send_link_if::sptr send_link, @@ -528,8 +540,13 @@ send_io_if::sptr offload_io_service_impl::make_send_client(send_link_if::sptr se } // Return a new recv client to the caller that just operates on the queues - return std::make_shared<offload_send_io<offload_io_service_impl>>( - shared_from_this(), num_recv_frames, num_send_frames, port); + if (_offload_thread_params.wait_mode == POLL) { + return std::make_shared<offload_send_io<offload_io_service_impl, true>>( + shared_from_this(), num_recv_frames, num_send_frames, port); + } else { + return std::make_shared<offload_send_io<offload_io_service_impl, false>>( + shared_from_this(), num_recv_frames, num_send_frames, port); + } } void offload_io_service_impl::_queue_client_req(std::function<void()> fn) |